Beispiel #1
0
        public ActionResult Edit(UserAddEdit viewmodel)
        {
            if (ModelState.IsValid)
            {
                using (_connection = Utilities.GetOpenConnection())
                {
                    _connection.Update(UserAddEdit.MapUserAddEditToUser(viewmodel));
                }
                return(RedirectToAction("index"));
            }

            return(View(viewmodel));
        }
Beispiel #2
0
 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));
 }