Exemplo n.º 1
0
        public T Put <V>(T obj) where V : AbstractValidator <T>
        {
            Validate(obj, Activator.CreateInstance <V>());

            _codeRepository.Update(obj);
            return(obj);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, PromoCodeViewModel promoCodeView)
        {
            if (id != promoCodeView.Id)
            {
                return(NotFound());
            }

            try
            {
                var promocode = await _promoCodeRepository.GetById(id);

                promocode.Amount          = promoCodeView.Amount;
                promocode.Coupon          = promoCodeView.Coupon;
                promocode.DiscountPercent = promoCodeView.DiscountPercent;

                await _promoCodeRepository.Update(promocode);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View("Error"));
            }
        }
Exemplo n.º 3
0
 public bool UpdatePromoCode(PromoCode promoCode)
 {
     _promoCodeRepository.Update(promoCode);
     return(true);
 }