public ActionResult Add(Person person) { PeopleDb db = new PeopleDb(_connectionString); db.Add(person); return(Redirect("/people/index")); }
public IActionResult Add(Person person) { var db = new PeopleDb(_connectionString); db.Add(person); return(Json(person)); }
public ActionResult Save(string name, string address, string nopoint) { var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True"); Customer c = new Customer(); c.Name = name; c.Address = address; db.Add(c); return(RedirectToAction("Index")); }
public IActionResult AddPerson(string firstName, string lastName, int age) { Person person = new Person { FirstName = firstName, LastName = lastName, Age = age }; PeopleDb db = new PeopleDb(_connectionString); db.Add(person); return(Redirect("/postdemo/showpeople")); }