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 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 ActionResult Delete(int id) { var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True"); db.Delete(id); return RedirectToAction("Index"); }
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 ActionResult Index() { var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True"); var ppl = db.GetAll(); return View(ppl); }