Пример #1
0
        public ActionResult Create([Bind(Include = "ID,Name")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
Пример #2
0
        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));
        }