public JsonResult CreateEmployee(Employee employee) { try { db.Employees.Add(employee); db.SaveChanges(); return Json(new { Result = "OK", Record = employee }); } catch (Exception ex) { return Json(new { Result = "ERROR", Message = ex.Message }); } }
public JsonResult EditEmployee(Employee employee) { try { // var std = db.Students.FirstOrDefault(x => x.StudentId==student.StudentId); db.Employees.AddOrUpdate(employee); db.SaveChanges(); return Json(new { Result = "OK", Record = employee }); } catch (Exception ex) { return Json(new { Result = "ERROR", Message = ex.Message }); } }