Beispiel #1
0
 public IHttpActionResult GetEmpLeaves(EmpLeavesVm model)
 {
     if (model == null)
     {
         return(BadRequest());
     }
     else
     {
         var list = hrUnitOfWork.LeaveRepository.ReadLeaveRequests(model.CompanyId, model.Culture)
                    .Where(l => l.EmpId == model.EmpId && (l.ReturnDate >= DateTime.Now) && l.ApprovalStatus != 8)
                    .OrderBy(l => l.StartDate)
                    .ThenBy(l => l.RequestDate).ToList();
         if (list == null)
         {
             return(NotFound());
         }
         return(Ok(list));
     }
 }
Beispiel #2
0
        public IHttpActionResult GetLeaveTypes(EmpLeavesVm model)
        {
            if (model == null)
            {
                return(BadRequest());
            }
            var LeaveTypeList = hrUnitOfWork.LeaveRepository.GetEmpLeaveTypes(model.EmpId, model.CompanyId, model.Culture).ToList();
            var ChartData     = hrUnitOfWork.LeaveRepository.AnnualLeavesProgress(model.EmpId, DateTime.Now, model.Culture).ToList();
            var Replacements  = hrUnitOfWork.LeaveRepository.GetReplaceEmpList(model.EmpId, model.Culture).ToList();
            var LeaveReasons  = hrUnitOfWork.LookUpRepository.GetLookUpCodes("LeaveReason", model.Culture).ToList();

            var res = new LeaveTypesData()
            {
                ChartData = ChartData, LeaveTypeList = LeaveTypeList, LeaveReasonList = LeaveReasons, Replacements = Replacements
            };

            if (LeaveTypeList == null)
            {
                return(NotFound());
            }
            return(Ok(res));
        }