예제 #1
0
 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 });
     }
 }
예제 #2
0
        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 });
            }
        }