Example #1
0
        public async Task <IActionResult> Create(PromoCodeViewModel promoCodeView)
        {
            if (ModelState.IsValid)
            {
                var promoCode = new PromoCode()
                {
                    Amount          = promoCodeView.Amount,
                    Coupon          = promoCodeView.Coupon,
                    DiscountPercent = promoCodeView.DiscountPercent,
                };

                await _promoCodeRepository.Create(promoCode);
            }

            return(RedirectToAction(nameof(Index)));
        }