public async Task <VideoEntity> GetVideo(string videoId) { using (var uow = this.CreateWithDisabledLazyLoading()) { var videosRep = uow.GetRepository <VideoEntity>(); return(await VideosMapper.MapToVideo( videosRep.GetAll(), videoId)); } }
public async Task <IReadOnlyList <VideoEntity> > GetChannelVideos(string channelId) { using (var uow = this.CreateWithDisabledLazyLoading()) { var channelsRep = uow.GetRepository <ChannelEntity>(); var videosRep = uow.GetRepository <VideoEntity>(); return(await VideosMapper.MapToChannelVideos( channelsRep.GetAll(), videosRep.GetAll(), channelId)); } }
public async Task UpdateDescription(string videoId, string description) { using (var uow = this.CreateWithDisabledLazyLoading()) { var videosRep = uow.GetRepository <VideoEntity>(); var entity = await VideosMapper.MapToVideo( videosRep.GetAll(), videoId); entity.Description = description; videosRep.Update(entity); await uow.SaveAsync(); } }
public ActionResult Update(Int64 videoID, Int64 munitionID) { ActionResult oResponse = View(videoID); try { VideosDO videos = dataAccess.ViewVideosByID(videoID); VideosPO displayObject = VideosMapper.MapDOtoPO(videos); oResponse = View(displayObject); } catch (Exception ex) { TempData["Message"] = "Video could not be updated at this time."; } return(oResponse); }
// GET: Videos public ActionResult Index(Int64 munitionID) { List <VideosPO> mappedVideos = new List <VideosPO>(); try { //Instantiating and mapping videos by munition ID List <VideosDO> videos = dataAccess.ViewVideos(munitionID); mappedVideos = VideosMapper.MapDOtoPO(videos); //Pass munitionID even if there aren't videos in table //if (videos.Count == 0) //{ // mappedVideos.Add(new VideosPO() { MunitionID = munitionID }); //} } catch (Exception ex) { } ViewBag.ID = munitionID; return(View(mappedVideos)); }
public ActionResult Update(VideosPO form) { //Declaring local variables ActionResult oResponse = RedirectToAction("Index", "Videos", new { form.VideoID, form.MunitionID }); if (ModelState.IsValid) { try { VideosDO dataObject = VideosMapper.MapPOtoDO(form); dataAccess.UpdateVideo(dataObject); TempData["Message"] = $"Successfully updated video"; } catch (Exception ex) { oResponse = View(form); } } else { oResponse = View(form); } return(oResponse); }