Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Module.Api.Commands.Models.Catalog;
using Grand.Mediator;
namespace Grand.Module.Api.Commands.Handlers.Catalog;
public class DeleteSpecificationAttributeCommandHandler : IRequestHandler<DeleteSpecificationAttributeCommand, bool>
{
private readonly ISpecificationAttributeService _specificationAttributeService;
public DeleteSpecificationAttributeCommandHandler(ISpecificationAttributeService specificationAttributeService)
{
_specificationAttributeService = specificationAttributeService;
}
public async Task<bool> Handle(DeleteSpecificationAttributeCommand request, CancellationToken cancellationToken)
{
var specificationAttribute =
await _specificationAttributeService.GetSpecificationAttributeById(request.Model.Id);
if (specificationAttribute != null)
await _specificationAttributeService.DeleteSpecificationAttribute(specificationAttribute);
return true;
}
}