public object GetPayroll([FromBody] GetPayrollRequestModel requestModel) { requestModel.Search = requestModel.Search ?? ""; requestModel.StartDate = requestModel.StartDate ?? new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); // default first day of month requestModel.EndDate = requestModel.EndDate ?? DateTime.Now; var result = payrollRepository.GetPayrolls(requestModel); var response = new List <GetPayrollViewModel>(); result.ForEach(item => response.Add(new GetPayrollViewModel { CitizenshipIdentifier = item.CitizenshipIdentifier, FirstName = item.FirstName, LastName = item.LastName, WorkDay = item.WorkDay, Salary = CalculateSalary(item), Date = item.Date })); return(response); }