Пример #1
0
        public IActionResult CheckHolidays(string first, string last)
        {
            var Check     = _holiday.GetAll().Where(x => x.DateDay.Date.ToString("yyyy-MM-dd").Equals(first) || x.DateDay.Date.ToString("yyyy-MM-dd").Equals(last)).FirstOrDefault();
            var TotalDays = (DateTime.Parse(last) - DateTime.Parse(first)).TotalDays <= 0 ? 1 : (DateTime.Parse(last) - DateTime.Parse(first)).TotalDays + 1;

            if (Check != null)
            {
                return(Json(new { message = Check.DayType, total = TotalDays }));
            }
            return(Json(new { message = false, total = TotalDays }));
        }
Пример #2
0
        public async Task <IActionResult> Get()
        {
            var holidays = await _holidaysService.GetAll();

            return(Ok(holidays));
        }