public ActionResult Salary(long empId, int month = -1, int year = -1) { logger.EnterMethod(); try { if (month > 0 && month <= 12 && year > 0) { DateTime date = new DateTime(year, month, 1); var empSalaries = this._iSalaryServices.GetSalariesForStaffPreviewNearest(empId, date).ToList(); if (empSalaries != null) { var emp = this._iStaffServices.Get(empId); var salaries = empSalaries.ToList(); var empCountAllSalaries = this._iSalaryServices.TotalSalariesInPast(empId); var model = ConvertVM.VMSalary_Add_VMEmpSalaryPaying_Add_History(ConvertVM.Staff_To_VMSalary(emp), new VM_EmpSalaryPaying() { ListEmpPaying = ConvertVM.Salary_To_VMSalaryPaying(salaries) }, empCountAllSalaries); return(View(model)); } } else { var empSalaries = this._iSalaryServices.GetSalariesForStaffPreviewNearest(empId); if (empSalaries.ToList() != null) { var emp = this._iStaffServices.Get(empId); var salaries = empSalaries.ToList(); var empCountAllSalaries = this._iSalaryServices.TotalSalariesInPast(empId); var model = ConvertVM.VMSalary_Add_VMEmpSalaryPaying_Add_History(ConvertVM.Staff_To_VMSalary(emp), new VM_EmpSalaryPaying() { ListEmpPaying = ConvertVM.Salary_To_VMSalaryPaying(salaries) }, empCountAllSalaries); return(View(model)); } } return(View("ErrorAdminPage")); } catch (Exception e) { logger.Error("Error: [" + e.Message + "]"); return(View("ErrorAdminPage")); } finally { logger.LeaveMethod(); } }