public void Execute() { var year = DateTime.Now.Year; _repository.DeleteHolidaysByYear(year); foreach (var enumValue in Enum.GetValues(typeof(CountryCodesEnum))) { var holidays = _naggerClient.GetPublicHolidays(year, enumValue.ToString()).Result; holidays.ForEach(x => x.EndDate = x.Date.AddHours(24)); _repository.InsertHolidays(holidays); } }
public ActionResult Create(HolidaysViewModel model) { if (ModelState.IsValid) { var Holidays = new Domain.Staff.Entities.Holidays(); AutoMapper.Mapper.Map(model, Holidays); Holidays.IsDeleted = false; Holidays.CreatedUserId = WebSecurity.CurrentUserId; Holidays.ModifiedUserId = WebSecurity.CurrentUserId; Holidays.CreatedDate = DateTime.Now; Holidays.ModifiedDate = DateTime.Now; HolidaysRepository.InsertHolidays(Holidays); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } return(View(model)); }