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.

1.3 KB
Raw Blame
using Grand.Business.Core.Commands.Catalog;
using Grand.Business.Core.Interfaces.Messages;
using Grand.Domain.Localization;
using Grand.Mediator;

namespace Grand.Module.ScheduledTasks.Commands.Handlers.Catalog;

public class
    SendQuantityBelowStoreOwnerNotificationCommandHandler : IRequestHandler<SendQuantityBelowStoreOwnerCommand, bool>
{
    private readonly LanguageSettings _languageSettings;
    private readonly IMessageProviderService _messageProviderService;

    public SendQuantityBelowStoreOwnerNotificationCommandHandler(
        IMessageProviderService messageProviderService,
        LanguageSettings languageSettings)
    {
        _messageProviderService = messageProviderService;
        _languageSettings = languageSettings;
    }

    public async Task<bool> Handle(SendQuantityBelowStoreOwnerCommand request, CancellationToken cancellationToken)
    {
        if (request.ProductAttributeCombination == null)
            await _messageProviderService.SendQuantityBelowStoreOwnerMessage(request.Product,
                _languageSettings.DefaultAdminLanguageId);
        else
            await _messageProviderService.SendQuantityBelowStoreOwnerMessage(request.Product,
                request.ProductAttributeCombination, _languageSettings.DefaultAdminLanguageId);

        return true;
    }
}