public JsonResult DelProviders(Provider _delpro) { var delitems = db.Providers.Find(_delpro.id); db.Providers.Remove(delitems); db.SaveChanges(); var result = db.Providers.ToList(); return Json(result, JsonRequestBehavior.AllowGet); }
//get provider by id public JsonResult GetProviderById(Provider EdtProvider) { var getId = db.Providers.Find(EdtProvider.id); var data = db.Providers.Where(s => s.id == getId.id).Select(x => new { id = x.id, name = x.name, address = x.address, phone = x.phone }).FirstOrDefault(); return Json(data, JsonRequestBehavior.AllowGet); }