public ActionResult AddPerson(Person person) { PeopleDb pdb = new PeopleDb(Properties.Settings.Default.conStr); pdb.AddPerson(person); return(Json(person)); }
public IActionResult AddPerson(Person person) { var db = new PeopleDb(_conStr); db.AddPerson(person); return(Json(person)); }
public ActionResult Add(string firstName, string lastName, int?age) { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); db.AddPerson(firstName, lastName, age); return(RedirectToAction("Index")); }
public IActionResult AddPerson(List <Person> ppl) { PeopleDb db = new PeopleDb(_conStr); foreach (Person p in ppl) { db.AddPerson(p); } return(Redirect("/")); }
public IActionResult Add(List <Person> people) { PeopleDb db = new PeopleDb(_connectionString); foreach (var person in people) { db.AddPerson(person); } string text = "people"; if (people.Count == 1) { text = "person"; } TempData["message"] = $"{people.Count} {text} added successfully!"; return(Redirect("/Home/Index")); }
public ActionResult Add(string firstName, string lastName, int? age) { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); db.AddPerson(firstName, lastName, age); return RedirectToAction("Index"); }