public EditEpisodeModel(IAuthService authService, IMetaTagService imts, ITagService ts, IDataService ds) : base(authService, imts, ds) { this.tagService = ts; Episode = new EpisodeWithTags(); Episode.episode = new Episode(); }
public AddEpisodeModel(IAuthService authService, IMetaTagService imts, ITagService ts, IDataService ds, ISeriesService ss) : base(authService, imts, ds) { this.tagService = ts; SavedEpisodeID = -1; Episode = new EpisodeWithTags(); Episode.episode = new Episode(); SS = ss; }
public async Task <IActionResult> OnPostEpisodeAsync() { bool epIsAffiliate = false; if (!string.IsNullOrEmpty(Request.Form["affiliateChckbx"]) && Request.Form["affiliateChckbx"] == "on") { epIsAffiliate = true; } if (!epIsAffiliate) { string s = UploadFile.Name; AttemptedSave = true; EpisodeSaved = "False"; HttpResponseMessage UploadResponse = await DS.PostImageAsync(UploadFile, "Episodes/ULE/" + SeriesID); if (UploadResponse.StatusCode != System.Net.HttpStatusCode.OK) { ResponseMessage = "Error Uploading file: " + UploadResponse.StatusCode.ToString(); AttemptedSave = true; return(Page()); } } Episode = new EpisodeWithTags(); List <Tag> Tags = new List <Tag>(); Episode E = new Episode(); if (epIsAffiliate) { E.Local = false; E.FileURL = Request.Form["affiliateFileURL"]; E.NonLocalType = 1; } else { E.FileURL = UploadFile.FileName; E.Local = true; E.NonLocalType = 3; } E.Description = Request.Form["shortDescription"]; E.EpImageURL = Request.Form["imgURLtextbox"]; E.Keywords = Request.Form["keywords"]; E.PostedByUserID = myAuthService.getUserID(); E.SeriesID = SeriesID; E.ShowDate = DateTime.Parse(Request.Form["myDatePicker"]); E.Size = Request.Form["epSize"]; E.SplashImageURL = Request.Form["splashImageInput"]; E.Time = Request.Form["epTime"]; E.Title = Request.Form["episodeTitle"]; E.TrackNumber = int.Parse(Request.Form["trackNumber"]); E.WebDescription = Request.Form["tinymcetextarea"]; string TagList = Request.Form["selectedTagIDs"]; if (TagList.Length > 0) { if (TagList.Substring(0, 1) == ",") { TagList = TagList.Substring(1, TagList.Length - 1); } string splitter = ","; string[] taglistarray = TagList.Split(splitter); for (int i = 0; i < taglistarray.Length; i++) { if (taglistarray[i] != "") { int TID = -1; if (int.TryParse(taglistarray[i], out TID)) { Tag t = new Tag(); t.TagID = TID; Tags.Add(t); } //Tag t = new Tag(); //t.TagID = int.Parse(taglistarray[i]); //Tags.Add(t); } } } Episode.episode = E; Episode.tags = Tags; Episode.TweetText = Request.Form["Tweet"]; HttpResponseMessage message = await DS.PostAsync(Episode, "Episodes/AddEpisode"); if (message.StatusCode != System.Net.HttpStatusCode.OK) { ResponseMessage = "There was a problem uploading the episode."; } else { string newEpID = await DS.GetAsync("Episodes/GetLatestEpisodeID"); SavedEpisodeID = Newtonsoft.Json.JsonConvert.DeserializeObject <int>(newEpID); } //Populate to restore page AttemptedSave = true; EpisodeSaved = "True"; EpSeries = await SS.GetSeriesByID(SeriesID); return(Page()); }