public async Task <IHttpActionResult> PutUnMute(UnMuteAppCommand command)
        {
            command.UserId = UserId;
            var commandResponse = await Bus.Send <UnMuteAppCommand, AppInfoCommandResponse>(command);

            var response = new ResponseModel
            {
                Message      = "روشن کردن صدای نوتیفیکیشن با موفقیت انجام شد",
                Success      = true,
                ResponseData = commandResponse
            };

            return(Ok(response));
        }
Beispiel #2
0
        public async Task <AppInfoCommandResponse> Handle(UnMuteAppCommand command)
        {
            switch (command.AppType)
            {
            case AppType.Customer:
                var customer = await _repository.AsQuery().OfType <Customer>()
                               .SingleOrDefaultAsync(p => p.UserId == command.UserId);

                if (customer == null)
                {
                    throw new DomainException("مشتری یافت نشد");
                }
                foreach (var customerAppInfo in customer.AppInfos)
                {
                    customerAppInfo.UnMuteApp();
                }
                break;

            case AppType.Shop:
                var shop = await _repository.AsQuery().OfType <Shop>()
                           .SingleOrDefaultAsync(p => p.UserId == command.UserId);

                if (shop == null)
                {
                    throw new DomainException("فروشگاه یافت نشد");
                }
                foreach (var shopAppInfo in shop.AppInfos)
                {
                    shopAppInfo.UnMuteApp();
                }
                break;

            default:
                throw new DomainException("پارامتر ارسالی نامعتبر می باشد");
            }
            return(new AppInfoCommandResponse());
        }