public ActionResult Employees_Create([DataSourceRequest] DataSourceRequest request, Employee employee) { if (ModelState.IsValid) { var entity = new Employee { FirstName = employee.FirstName, LastName = employee.LastName, MiddleName = employee.MiddleName, Phone = employee.Phone, Salary = employee.Salary, Email = employee.Email, }; db.Employees.Add(entity); db.SaveChanges(); employee.EmpId = entity.EmpId; } return(Json(new[] { employee }.ToDataSourceResult(request, ModelState))); }
public void Save() { _entities.SaveChanges(); }