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); }
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); }
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); }