public ActionResult Create([Bind(Include = "ID,Name")] User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public IActionResult NewUser(string firstName, string lastName, string email) { AppUsers newCustomer = new AppUsers(); newCustomer.FirstName = firstName; newCustomer.LastName = lastName; newCustomer.EmailAddress = email; newCustomer.DateAdded = DateTime.Now; _context.Users.Add(newCustomer); _context.SaveChanges(); return(Json(newCustomer)); }