public IActionResult Add(Person person) { var db = new PeopleDb(_connectionString); db.Add(person); return(Json(person)); }
public ActionResult Delete(int pid) { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); db.Delete(pid); return(RedirectToAction("Index")); }
public IActionResult GetAll() { var db = new PeopleDb(_connectionString); List <Person> ppl = db.GetAll(); return(Json(ppl)); }
public ActionResult Edit(int pid) { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); Person person = db.GetById(pid); return(View(person)); }
public ActionResult DeletePerson(int personId) { PeopleDb pdb = new PeopleDb(Properties.Settings.Default.conStr); pdb.DeletePerson(personId); return(Json(personId)); }
public ActionResult Index() { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); IEnumerable <Person> ppl = db.GetAll(); return(View(ppl)); }
public ActionResult Index() { PeopleDb pdb = new PeopleDb(Properties.Settings.Default.conStr); IEnumerable <Person> people = pdb.GetAllPeople(); return(View(people)); }
public ActionResult Index() { var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True"); var ppl = db.GetAll(); return(View(ppl)); }
public IActionResult Delete(int id) { PeopleDb db = new PeopleDb(_connectionString); db.Delete(id); return(Redirect("/postdemo/showpeople")); }
public ActionResult Edit(int personId) { var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True"); Customer c = db.FindById(personId); return(View(c)); }
public IActionResult Update(Person person) { PeopleDb db = new PeopleDb(_connectionString); db.Update(person); return(Redirect("/postdemo/showpeople")); }
public ActionResult Delete(int id) { var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True"); db.Delete(id); return(RedirectToAction("Index")); }
public virtual void SaveItem(T obj) { using (PeopleDb db = new PeopleDb()) { db.Set <T>().Add(obj); db.SaveChanges(); } }
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 EditPerson(Person person) { var db = new PeopleDb(_conStr); db.EditPerson(person); return(Json(person)); }
public ActionResult EditPerson(Person person) { PeopleDb pdb = new PeopleDb(Properties.Settings.Default.conStr); pdb.EditPerson(person); return(Json(person)); }
public IActionResult DeletePerson(int id) { var db = new PeopleDb(_conStr); db.DeletePerson(id); return(Json(id)); }
public ActionResult GetPeople() { PeopleDb pdb = new PeopleDb(Properties.Settings.Default.conStr); IEnumerable <Person> people = pdb.GetAllPeople(); return(Json(people, JsonRequestBehavior.AllowGet)); }
public void SaveItem(Person obj) { using (var PeopleDb = new PeopleDb()) { PeopleDb.Person.Add(obj); PeopleDb.SaveChanges(); } }
public ActionResult Delete(int id) { PeopleDb db = new PeopleDb(_connectionString); db.Delete(id); return(Redirect("/people/index")); }
public ActionResult Add(Person person) { PeopleDb db = new PeopleDb(_connectionString); db.Add(person); return(Redirect("/people/index")); }
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 ActionResult Index() { PeopleDb db = new PeopleDb(_connectionString); PeopleViewModel vm = new PeopleViewModel { People = db.GetAll() }; return(View(vm)); }
public IActionResult AddPerson(List <Person> ppl) { PeopleDb db = new PeopleDb(_conStr); foreach (Person p in ppl) { db.AddPerson(p); } return(Redirect("/")); }
public virtual IEnumerable <T> GetItems() { IEnumerable <T> results = null; using (PeopleDb db = new PeopleDb()) { results = db.Set <T>().ToList(); } return(results); }
public ActionResult Edit(string name, string address, int customerId) { var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True"); Customer c = new Customer(); c.Name = name; c.Address = address; c.Id = customerId; db.Update(c); return(RedirectToAction("Index")); }
public MainPageViewModel() { peopleDb = new PeopleDb(Constants.DatabasePath); var people = peopleDb.GetPeople(); if (people.Any()) { var lastRecord = people.OrderByDescending(by => by.PersonId).First(); firstName = lastRecord.FirstName; lastName = lastRecord.LastName; } }
public IActionResult Index() { PeopleDb db = new PeopleDb(_connectionString); PeopleViewModel vm = new PeopleViewModel(); vm.People = db.GetPeople(); if (TempData["message"] != null) { vm.Message = (string)TempData["message"]; } return(View(vm)); }
public IActionResult Edit(int id) { PeopleDb db = new PeopleDb(_connectionString); Person person = db.GetPerson(id); if (person == null) { return(Redirect("/postdemo/showpeople")); } return(View(person)); }
public ActionResult Edit(int personId, string firstName, string lastName, int? age) { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); Person p = new Person { FirstName = firstName, LastName = lastName, Age = age, Id = personId }; db.Update(p); 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")); }
public ActionResult Delete(int pid) { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); db.Delete(pid); return RedirectToAction("Index"); }
public ActionResult Index() { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); IEnumerable<Person> ppl = db.GetAll(); return View(ppl); }
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 ActionResult Edit(int pid) { var db = new PeopleDb(ConfigurationManager.ConnectionStrings["MvcApplication2.Properties.Settings.PeopleConStr"].ConnectionString); Person person = db.GetById(pid); return View(person); }