public async Task <AddSliderToDiscountCommandResponse> Handle(AddSliderToDiscountCommand command)
        {
            var slider = await _repository.AsQuery().SingleOrDefaultAsync(p => p.ImageName == command.ImageName);

            if (slider == null)
            {
                throw new DomainException(" اسلایدر یافت نشد");
            }

            var disCount = await _discountRepository.FindAsync(command.DiscountId);

            if (disCount == null)
            {
                throw new DomainException("تخفیف موجود نیست");
            }
            slider.AdditionalData = command.DiscountId;
            slider.SliderType     = command.SliderType;
            return(new AddSliderToDiscountCommandResponse());
        }
Beispiel #2
0
        public async Task <IHttpActionResult> Put(AddSliderToDiscountCommand command)
        {
            var response = await Bus.Send <AddSliderToDiscountCommand, AddSliderToDiscountCommandResponse>(command);

            return(Ok(response));
        }