Exemple #1
0
        public void CreatePaymentMethod(PaymentMethodCreateViewModel model)
        {
            var paymentMethod = Mapper.Map <Domains.DataObject.PaymentMethod>(model);

            _dbContext.PaymentMethods.Add(paymentMethod);
            _dbContext.SaveChanges();
        }
Exemple #2
0
        public PaymentMethodCreateViewModel BuildPaymentMethodCreateViewModel(string previousUrl)
        {
            var model = new PaymentMethodCreateViewModel
            {
                PreviousUrl = previousUrl
            };

            return(model);
        }
Exemple #3
0
        public virtual async Task <ActionResult> Create(PaymentMethodCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            model.CreatorID = await GetCurrentUserIdAsync();

            _paymentMethodService.CreatePaymentMethod(model);

            if (string.IsNullOrEmpty(model.PreviousUrl))
            {
                return(RedirectToAction(MVC.Home.ActionNames.Index, MVC.Home.Name));
            }
            return(Redirect(model.PreviousUrl));
        }