Ejemplo n.º 1
0
        public Task <DiscountDTO> UpdateAsync(DiscountDTO discountDTO)
        {
            var existingDiscount = Discounts.Get(discountDTO.Id);

            if (existingDiscount == null)
            {
                throw new Exception(string.Format(ERROR_DISCOUNT_NOT_FOUND, discountDTO.Id));
            }

            CheckValidProductSKU(discountDTO);

            Discounts.AddOrUpdate(discountDTO.ToModel());

            return(Task.FromResult <DiscountDTO>(discountDTO));
        }