public ActionResult Create(User user) { DataContext _db = new DataContext(); if (ModelState.IsValid) { try { _db.Users.Add(user); _db.SaveChanges(); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex); } } return RedirectToAction("Create"); }
public ActionResult GetUsers() { DataContext _db = new DataContext(); var res = _db.Users; return View(res); }