public async Task <JsonResult> Update(UpdateEmployeeModel employee) { if (ModelState.IsValid) { var result = await _employeeOrchestrator.UpdateEmployee(new EmployeeViewModel { RecordGuid = employee.RecordGuid, FirstName = employee.FirstName, MiddleName = employee.MiddleName, LastName = employee.LastName, BirthDate = employee.BirthDate, HireDate = employee.HireDate, Department = employee.Department, JobTitle = employee.JobTitle, PayRate = employee.PayRate, SalaryType = employee.SalaryType, EmployeeId = employee.EmployeeId, AvailableHours = employee.AvailableHours }); return(Json(result, JsonRequestBehavior.AllowGet)); } if (employee.RecordGuid == Guid.Empty) { return(Json(false, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> UpdateStudent(UpdateEmployeeModel employee) { if (employee.EmployeeId == Guid.Empty) { return(Json(false, JsonRequestBehavior.AllowGet)); } var result = await _employeeOrchestrator.UpdateEmployee(new EmployeeViewModel { EmployeeId = Guid.NewGuid(), EmployeeName = employee.Name, Email = employee.Email, Role = employee.Role }); return(Json(result, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> UpdateEmployee(UpdateEmployeeModel employee) { if (employee.EmployeeId == null) { return(Json(false, JsonRequestBehavior.AllowGet)); } var result = await _employeeOrchestrator.UpdateEmployee(new EmployeeViewModel { FirstName = employee.FirstName, MiddleName = employee.MiddleName, LastName = employee.LastName, BirthDate = employee.BirthDate, HireDate = employee.HireDate, Department = employee.Department, JobTitle = employee.JobTitle, Salary = employee.Salary, EmployeeId = employee.EmployeeId, AvailableHours = employee.AvailableHours }); return(Json(result, JsonRequestBehavior.AllowGet)); }