예제 #1
0
 public JsonResult DelCustomer(Customer _delCustomer)
 {
     var db = new MyDbContext();
     var delcustomer = db.Customers.Find(_delCustomer.id);
     db.Customers.Remove(delcustomer);
     db.SaveChanges();
     var result = db.Customers.ToList();
     return Json(result, JsonRequestBehavior.AllowGet);
 }
예제 #2
0
 public JsonResult DelPhieuchi(List delchi)
 {
     var db = new MyDbContext();
     var deleteChi = db.Lists.Find(delchi.id);
     db.Lists.Remove(deleteChi);
     db.SaveChanges();
     var data = db.Lists.Where(s => s.status == 1).ToList();
     return Json(data, JsonRequestBehavior.AllowGet);
 }
예제 #3
0
 public JsonResult AddCustomer(string _addname, string _addaddress, string _addphone)
 {
     var db = new MyDbContext();
     db.Customers.Add(new Customer()
     {
         name = _addname,
         address = _addaddress,
         phone = _addphone
     });
     db.SaveChanges();
     var result = db.Customers.ToList();
     return Json(result, JsonRequestBehavior.AllowGet);
 }