Esempio n. 1
0
        public PaymentСode EditPaymentСode(int paymentСodeId, PaymentCodeInfoViewModel model)
        {
            PaymentСode payment = FindPaymentСodeId(paymentСodeId);

            payment.Code            = model.Code;
            payment.PaymentCodeName = model.PaymentCodeName;

            context.PaymentСodies.Update(payment);
            context.SaveChanges();
            return(payment);
        }
Esempio n. 2
0
        public PaymentСode CreatePaymentСode(PaymentCodeInfoViewModel model)
        {
            PaymentСode payment = new PaymentСode
            {
                Code            = model.Code,
                PaymentCodeName = model.PaymentCodeName
            };

            context.PaymentСodies.Add(payment);
            context.SaveChanges();
            return(payment);
        }
        public IActionResult CreatePaymentCode(PaymentCodeInfoViewModel model)
        {
            PaymentСode paymentСode = paymentCodeService.FindPaymentСodeIsCode(model.Code);

            if (paymentСode != null)
            {
                ModelState.AddModelError("Code", "Такой код платеж уже существует");
            }

            if (ModelState.IsValid)
            {
                paymentCodeService.CreatePaymentСode(model);

                return(RedirectToAction("PaymentCodeList", "LimitPaymentCode"));
            }
            else
            {
                return(View(model));
            }
        }