Skip to content

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.

777 B
Raw Blame
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Queries.Customers;
using Grand.Domain.Customers;
using Grand.Mediator;

namespace Grand.Business.Customers.Queries.Handlers;

public class GetGroupBySystemNameQueryHandler : IRequestHandler<GetGroupBySystemNameQuery, CustomerGroup>
{
    private readonly IGroupService _groupService;

    public GetGroupBySystemNameQueryHandler(IGroupService groupService)
    {
        _groupService = groupService;
    }

    public async Task<CustomerGroup> Handle(GetGroupBySystemNameQuery request, CancellationToken cancellationToken)
    {
        ArgumentNullException.ThrowIfNullOrEmpty(request.SystemName);

        return await _groupService.GetCustomerGroupBySystemName(request.SystemName);
    }
}