// GET: AdminHolidays public ActionResult Index() { return(View(HolidayService.GetHolidays().Select(s => new AdminHolidaysModel() { date = s.date, duration = s.duration, market_id = s.market_id, Id = s.Id, market_name = s.market_name }))); }
private async Task ShowHolidays(IDialogContext context, IAwaitable <object> result) { try { List <Holiday> holidays = _holidayService.GetHolidays(false, _dateRange); await context.PostAsync($"There are a total of {holidays.Count} holidays"); var resultMessage = context.MakeMessage(); resultMessage.AttachmentLayout = AttachmentLayoutTypes.Carousel; resultMessage.Attachments = new List <Attachment>(); resultMessage.Attachments = AdaptiveCardJsonManager.CreateCards(holidays).ToList(); await context.PostAsync(resultMessage); } catch (FormCanceledException ex) { string reply; if (ex.InnerException == null) { reply = "You have canceled the operation."; } else { reply = $"Oops! Something went wrong :( Technical Details: {ex.InnerException.Message}"; } await context.PostAsync(reply); } finally { context.Done <object>(null); } }
// GET: AdminHolidays/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AdminHolidaysModel adminHolidaysModel = HolidayService.GetHolidays().Where(s => s.Id == id).Select(s => new AdminHolidaysModel() { date = s.date, duration = s.duration, market_id = s.market_id, Id = s.Id, market_name = s.market_name }).FirstOrDefault(); if (adminHolidaysModel == null) { return(HttpNotFound()); } return(View(adminHolidaysModel)); }
// GET: AdminHolidays/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AdminHolidaysModel adminHolidaysModel = HolidayService.GetHolidays().Where(s => s.Id == id).Select(s => new AdminHolidaysModel() { date = s.date, duration = s.duration, market_id = s.market_id, Id = s.Id, market_name = s.market_name }).FirstOrDefault(); if (adminHolidaysModel == null) { return(HttpNotFound()); } ViewBag.market_id = new SelectList(MarketService.GetMarkets().Select(m => new AdminMarketsModel() { Id = m.Id, name = m.name, work_hours = m.work_hours }), "Id", "name", adminHolidaysModel.market_id); return(View(adminHolidaysModel)); }
private async Task ShowFlexibleHolidays(IDialogContext context, IAwaitable <object> result) { try { List <Holiday> flexibleHolidays = _holidayService.GetHolidays(true, _dateRange); await context.PostAsync($"There are a total of {flexibleHolidays.Count} Flexible holidays"); await context.PostAsync("To Opt In any Flexible holiday, Press the Opt In button"); var resultMessage = context.MakeMessage(); resultMessage.AttachmentLayout = AttachmentLayoutTypes.Carousel; resultMessage.Attachments = new List <Attachment>(); resultMessage.Attachments = HeroCardManager.CreateFlexibleHolidayCards(flexibleHolidays).ToList(); await context.PostAsync(resultMessage); await context.PostAsync("If you want to leave this panel, enter quit"); context.Wait(OptInRequest); } catch (FormCanceledException ex) { string reply; if (ex.InnerException == null) { reply = "You have canceled the operation. Quitting from the Flights Search"; } else { reply = $"Oops! Something went wrong :( Technical Details: {ex.InnerException.Message}"; } await context.PostAsync(reply); } }
public override async Task WhenAsync() { _result = await HolidayService.GetHolidays( new DateTime(2020, 1, 1), new DateTime(2020, 12, 31)); }
public override async Task WhenAsync() { _result = await _holidayService.GetHolidays(DateTime.Now, DateTime.Now.AddDays(7)); }
public ActionResult DeleteConfirmed(int id) { HolidayService.DeleteHoliday(HolidayService.GetHolidays().Where(s => s.Id == id).FirstOrDefault()); return(RedirectToAction("Index")); }
public override async Task WhenAsync() { _result = await HolidayService.GetHolidays( new DateTime(2021, 4, 1), new DateTime(2021, 9, 10)); }
public List <HolidayModel> PublicHolidays(int startYear, int endYear) { return(holidayService.GetHolidays(startYear, endYear)); }
public HolidayPageViewModel(HolidayService holidayService) { _HolidayService = holidayService; Holidays = new ObservableCollection <Holiday>(_HolidayService.GetHolidays()); }