Exemplo n.º 1
0
        public List <HolidayView> GetCompanyHolidays(int companyId, int userId, DateTime stDate, DateTime enDate)
        {
            List <Holiday> holidays;

            using (PunchClockDbContext context = new PunchClockDbContext())
            {
                holidays = context.GetCompanyHolidays(companyId).ToList();
            }
            if (stDate != DateTime.MinValue)
            {
                holidays = holidays.Where(x => x.HolidayDate >= stDate.Date).ToList();
            }
            if (enDate != DateTime.MinValue)
            {
                holidays = holidays.Where(x => x.HolidayDate <= enDate.Date).ToList();
            }
            var holidayViews = new List <HolidayView>();

            new Map().DomainToView(holidayViews, holidays);
            return(holidayViews);
        }
Exemplo n.º 2
0
 //public IEnumerable<usp_GetCompanyHolidaysForEmployee_Result> usp_GetCompanyHolidaysForEmployee(int companyId, int employeeId)
 //{
 //    if (_context != null) return _context.usp_GetCompanyHolidaysForEmployee(companyId, employeeId).ToList();
 //}
 public List <Holiday> GetCompanyHolidays(int companyId)
 {
     return(_context.GetCompanyHolidays(companyId));
 }