public HttpResponseMessage Update(HttpRequestMessage request, CommissionedEmployeeViewModel commissionedemployee) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState.Keys.SelectMany(k => ModelState[k].Errors) .Select(m => m.ErrorMessage).ToArray()); } else { CommissionedEmployee _commissionedemployee = _commissionedemployeeRepository.GetSingle(commissionedemployee.ID); _commissionedemployee.UpdateCommissionedEmployee(commissionedemployee); _unitOfWork.Commit(); response = request.CreateResponse(HttpStatusCode.OK); } return response; })); }
public static void UpdateCommissionedEmployee(this CommissionedEmployee commissionedemployee, CommissionedEmployeeViewModel commissionedemployeeVm) { commissionedemployee.EmployeeMonthlySalary = commissionedemployeeVm.EmployeeMonthlySalary; commissionedemployee.MonthlyWorkingHours = commissionedemployeeVm.MonthlyWorkingHours; commissionedemployee.WeeeklyPaid = commissionedemployeeVm.WeeeklyPaid; }