Пример #1
0
 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");
 }
Пример #2
0
 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");
 }
Пример #3
0
 public ActionResult Delete(int id)
 {
     var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True");
     db.Delete(id);
     return RedirectToAction("Index");
 }
Пример #4
0
 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);
 }
Пример #5
0
 public ActionResult Index()
 {
     var db = new PeopleDb(@"Data Source=.\sqlexpress;Initial Catalog=Food;Integrated Security=True");
     var ppl = db.GetAll();
     return View(ppl);
 }