public void CreatePaymentMethod(PaymentMethodCreateViewModel model) { var paymentMethod = Mapper.Map <Domains.DataObject.PaymentMethod>(model); _dbContext.PaymentMethods.Add(paymentMethod); _dbContext.SaveChanges(); }
public PaymentMethodCreateViewModel BuildPaymentMethodCreateViewModel(string previousUrl) { var model = new PaymentMethodCreateViewModel { PreviousUrl = previousUrl }; return(model); }
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)); }