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.Common.Directory;
using Grand.Module.Api.Commands.Models.Customers;
using Grand.Module.Api.DTOs.Customers;
using Grand.Module.Api.Extensions;
using Grand.Mediator;
namespace Grand.Module.Api.Commands.Handlers.Customers;
public class AddCustomerGroupCommandHandler : IRequestHandler<AddCustomerGroupCommand, CustomerGroupDto>
{
private readonly IGroupService _groupService;
public AddCustomerGroupCommandHandler(IGroupService groupService)
{
_groupService = groupService;
}
public async Task<CustomerGroupDto> Handle(AddCustomerGroupCommand request, CancellationToken cancellationToken)
{
var customergroup = request.Model.ToEntity();
await _groupService.InsertCustomerGroup(customergroup);
return customergroup.ToModel();
}
}