Exemplo n.º 1
0
        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");
        }