public ActionResult Edit(UserAddEdit viewmodel) { if (ModelState.IsValid) { using (_connection = Utilities.GetOpenConnection()) { _connection.Update(UserAddEdit.MapUserAddEditToUser(viewmodel)); } return(RedirectToAction("index")); } return(View(viewmodel)); }
public ActionResult Create(UserAddEdit viewmodel) { if (ModelState.IsValid) { //manual mapping - this would be easier with automapper var user = UserAddEdit.MapUserAddEditToUser(viewmodel); using (_connection = Utilities.GetOpenConnection()) { _connection.Insert(user); } return(RedirectToAction("index")); } return(View(viewmodel)); }