public void CreateTransactionType(TransactionTypeCreateViewModel model) { var transactionType = Mapper.Map <Domains.DataObject.TransactionType>(model); _dbContext.TransactionTypes.Add(transactionType); _dbContext.SaveChanges(); }
public TransactionTypeCreateViewModel BuildTransactionTypeCreateViewModel(string previousUrl) { var model = new TransactionTypeCreateViewModel { PreviousUrl = previousUrl }; return(model); }
public virtual async Task <ActionResult> Create(TransactionTypeCreateViewModel model) { if (!ModelState.IsValid) { return(View(model)); } model.CreatorID = await GetCurrentUserIdAsync(); _transactionTypeService.CreateTransactionType(model); if (string.IsNullOrEmpty(model.PreviousUrl)) { return(RedirectToAction(MVC.Home.ActionNames.Index, MVC.Home.Name)); } return(Redirect(model.PreviousUrl)); }