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"); } }
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"); } }