private Task <List <OnlineEvent> > GetEventsInMonth(DateTime date) { var fromDate = date.AddDays(-8); //ponieważ widoczna jest zmienna liczba dni z przeszłego i przyszłego miesiąca var toDate = date.AddDays(45); return(_httpHelper.GetAsync <List <OnlineEvent> >(BandCamsEndpoints.GetOnlineEvent(fromDate, toDate))); }
public async Task OnGet() { var today = DateTime.Now; Streams = await _httpHelper.GetAsync <List <Stream> >(BandCamsEndpoints.GetStream(true)); OnlineEvents = await _httpHelper.GetAsync <List <OnlineEvent> > (BandCamsEndpoints.GetOnlineEvent(today, today.AddDays(7))); }
public async Task <PartialViewResult> OnGetShowModal(int streamId) { var stream = await _httpHelper.GetAsync <Stream>(BandCamsEndpoints.GetStream(streamId)); return(new PartialViewResult { ViewName = "_StreamVideoPartial", ViewData = new ViewDataDictionary <Stream>(ViewData, stream) }); }
public void GetStreamIsActiveFalseTest() { // arrange const string excepted = "/api/Stream?isActive=false"; // act var actual = BandCamsEndpoints.GetStream(false); // assert StringAssert.AreEqualIgnoringCase(excepted, actual); }
public void GetStreamTest() { // arrange var randomId = new Random().Next(1, 20); var expected = $"/api/Stream/{randomId}"; // act var actual = BandCamsEndpoints.GetStream(randomId); // assert StringAssert.AreEqualIgnoringCase(expected, actual); }
public async Task <PartialViewResult> OnGetShowModal(int year, int month, int day) { var passedDate = new DateTime(year, month, day); OnlineEvents = await _httpHelper.GetAsync <List <OnlineEvent> >(BandCamsEndpoints.GetOnlineEvent(passedDate, passedDate.AddDays(1))); return(new PartialViewResult { ViewName = "_OnlineEventsPartial", ViewData = new ViewDataDictionary <List <OnlineEvent> >(ViewData, OnlineEvents) }); }
public void GetOnlineEventInDatesTest() { // arrange var now = DateTime.Now; var tomorrow = now.AddDays(1); var expected = $"/api/OnlineEvent?fromDate={now.Year}-{now.Month}-{now.Day}&toDate={tomorrow.Year}-{tomorrow.Month}-{tomorrow.Day}"; // act var actual = BandCamsEndpoints.GetOnlineEvent(now, tomorrow); // assert StringAssert.AreEqualIgnoringCase(expected, actual); }
public async Task <IActionResult> OnGet(int id) { try { OnlineEvent = await _httpHelper.GetAsync <OnlineEvent>(BandCamsEndpoints.GetOnlineEvent(id)); return(Page()); } catch (Exception)//TODO porządna obsługa - słabe rozwiązanie bo każdy wyjątek kalsyfikujemy jakby api zwróciło 404 { return(NotFound()); } }