Exemplo n.º 1
0
        public ActionResult Create()
        {
            try
            {
                User user = new User();

                return View(user);
            }
            catch (SqlException sqlException)
            {
                return View("../Shared/DbError");
            }
            catch (Exception e)
            {
                return View("../Shared/Error");
            }
        }
Exemplo n.º 2
0
 public ActionResult Create(User user)
 {
     try
     {
         if (ModelState.IsValid)
         {
             userRepository.addUser(user);
             return RedirectToAction("Details", new { id = user.userName });
         }
         return View(user);
     }
     catch (SqlException sqlException)
     {
         return View("../Shared/DbError");
     }
     catch (Exception e)
     {
         return View("../Shared/Error");
     }
 }