public async Task <IActionResult> OnPostChannelAsync() { StreamSeries SC = new StreamSeries(); bool SaveNew = false; try { SC.StreamSeriesID = int.Parse(Request.Form["StreamSeriesID"]); ID = SC.StreamSeriesID; } catch (Exception ex) { SaveNew = true; } SC.StreamChannelID = int.Parse(Request.Form["Channel"]); SC.Title = Request.Form["Title"]; SC.Description = Request.Form["Description"]; SC.FacebookURL = Request.Form["Facebook"].ToString().Trim(); SC.ImageURL = Request.Form["imgURLtextbox"]; if (Request.Form["Enabled"] == "on") { SC.Enabled = true; } else { SC.Enabled = false; } string sd = Request.Form["StartDate"]; SC.StartDate = DateTime.Parse(Request.Form["StartDate"]); SC.EndDate = DateTime.Parse(Request.Form["EndDate"]); SC.TwitchURL = Request.Form["Twitch"].ToString().Trim(); SC.YoutubeURL = Request.Form["Youtube"].ToString().Trim(); SC.Enabled = true; if (SaveNew) { ReturnSR = await DS.PostAsyncSR(SC, "Streaming/AddStreamSeries"); ID = int.Parse(ReturnSR.Response); } else { ReturnSR = await DS.PutAsyncSR(SC, "Streaming/UpdateStreamSeries"); } string ChannelResponse = await DS.GetAsync("streaming/GetChannelsForUser"); Channels = JsonConvert.DeserializeObject <List <StreamChannel> >(ChannelResponse); await GetChannel(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { SC = new StreamSeries(); SC.StartDate = DateTime.Now; SC.EndDate = DateTime.Now.AddDays(7); SC.Enabled = true; string ChannelResponse = await DS.GetAsync("streaming/GetChannelsForUser"); Channels = JsonConvert.DeserializeObject <List <StreamChannel> >(ChannelResponse); if (ID != 0) { await GetChannel(); } return(Page()); }