public JsonResult delEmployee(Employee delEmploy) { var delemp = db.Employees.Find(delEmploy.id); db.Employees.Remove(delemp); db.SaveChanges(); var result = db.Employees.ToList(); return Json(result, JsonRequestBehavior.AllowGet); }
public JsonResult GetEmployeeById(Employee EmpId) { var idemp = db.Employees.Find(EmpId.id); var data = db.Employees.Where(g => g.id == idemp.id).Select(x => new { id = x.id, name = x.name, address = x.address, phone = x.phone }).FirstOrDefault(); return Json(data, JsonRequestBehavior.AllowGet); }