public ActionResult GetById(int vId) { var video = _videoRepository.Find(vId); var transcripts = _videoTranscriptRepository.GetMany(vt => vt.VideoId == vId).ToList(); ViewBag.hasContent = !string.IsNullOrEmpty(video.Content); return(PartialView("_ListFull", transcripts)); }
public string Get(long id) { try { return(db.Find(id).Url); } catch (Exception ex) { Log.Error(ex.Message, ex); return(null); } }
public StartRecommendModel GetSpecialVideoBy(int Id) { VideoEntity entity = _video.Find(Id); StartRecommendModel model = Mapper.Map <StartRecommendModel>(entity); return(model); }
public JsonResult DeleteConfirmed(int id, string confirmText) { var success = false; var error = ""; List <int> ids = new List <int>(); if (confirmText.ToLower() == "đồng ý") { var scheduleDetail = _scheduleDetailRepository.Find(id); if (scheduleDetail != null) { if (scheduleDetail.VideoId.HasValue && scheduleDetail.IsNew == true) { var videoId = scheduleDetail.VideoId.Value; var video = _videoRepository.Find(videoId); //Xóa toàn bộ các chương trình liên quan for (int i = video.ScheduleDetails.Count - 1; i >= 0; i--) { var scheduleDetailId = video.ScheduleDetails.ElementAt(i).Id; ids.Add(scheduleDetailId); _scheduleDetailRepository.Delete(scheduleDetailId); } _scheduleDetailRepository.Save(); //Xóa video using (new Impersonator("uploaduser", "", "Upload@@123")) { string thumbnailPath = VITV.Web.Helpers.UrlHelper.GetPhysicalPath(this, video.Thumbnail); if (System.IO.File.Exists(thumbnailPath)) { System.IO.File.Delete(thumbnailPath); } string videoPath = VITV.Web.Helpers.UrlHelper.GetPhysicalPath(this, video.Url); if (System.IO.File.Exists(videoPath)) { System.IO.File.Delete(videoPath); } } _videoRepository.Delete(videoId, User.Identity.Name, "Xóa lịch phát sóng"); _videoRepository.Save(); } else { ids.Add(id); //Xóa chương trình _scheduleDetailRepository.Delete(id); _scheduleDetailRepository.Save(); } success = true; } else { error = "Không tìm thấy chương trình"; } } else { error = "Chuỗi nhập vào không đúng"; } return(Json(new { success = success, ids = ids, error = error })); }
public async Task <IEnumerable <Video> > Find(Expression <Func <Video, bool> > predicate) { return(await _videoRepository.Find(predicate)); }
public ActionResult VideoReport(int videoId) { var vitvContext = new VITVContext(); var video = _videoRepository.Find(videoId); var gaContext = new GoogleAnalyticContext(); List <AgeReport> ages = gaContext.Ages.Where(a => a.VideoId == videoId).GroupBy(a => a.Name).Select( g => new AgeReport { Name = g.Key, SessionCount = g.Sum(a => a.SessionCount), NewUser = g.Sum(a => a.NewUser), PageView = g.Sum(a => a.PageView) } ).ToList(); List <GenderReport> genders = gaContext.Genders.Where(a => a.VideoId == videoId).GroupBy(a => a.Name).Select( g => new GenderReport { Name = g.Key, SessionCount = g.Sum(a => a.SessionCount), NewUser = g.Sum(a => a.NewUser), PageView = g.Sum(a => a.PageView) } ).ToList(); List <SocialNetworkReport> socialNetworks = gaContext.SocialNetworkDetails.Where(a => a.VideoId == videoId).GroupBy(a => a.Name).Select( g => new SocialNetworkReport { Name = g.Key, SessionCount = g.Sum(a => a.SessionCount), PageView = g.Sum(a => a.PageView) } ).ToList(); List <CountryIsoCodeReport> countries = gaContext.CountryIsoCodes.Where(a => a.VideoId == videoId).GroupBy(a => new { Name = a.Name, FullName = a.FullName }).Select( g => new CountryIsoCodeReport { Name = g.Key.Name, FullName = g.Key.FullName, SessionCount = g.Sum(a => a.SessionCount), PageView = g.Sum(a => a.PageView), NewUser = g.Sum(a => a.NewUser) } ).ToList(); // g => new CityReport // { // Name = g.Key, // SessionCount = g.Sum(a => a.SessionCount), // NewUser = g.Sum(a => a.NewUser) // } //).ToList(); List <UserTypeReport> userTypes = gaContext.UserTypes.Where(a => a.VideoId == videoId).GroupBy(a => a.Name).Select( g => new UserTypeReport { Name = g.Key, SessionCount = g.Sum(a => a.SessionCount), PageView = g.Sum(a => a.PageView) } ).ToList(); List <OSReport> OSs = gaContext.OSs.Where(a => a.VideoId == videoId).GroupBy(a => a.Name).Select( g => new OSReport { Name = g.Key, SessionCount = g.Sum(a => a.SessionCount), NewUser = g.Sum(a => a.NewUser), PageView = g.Sum(a => a.PageView) } ).ToList(); ViewBag.Ages = ages; ViewBag.Genders = genders; ViewBag.SocialNetworks = socialNetworks; ViewBag.Countries = countries; ViewBag.UserTypes = userTypes; ViewBag.OSs = OSs; return(View(video)); }
public void DeleteBy(int id) { VideoEntity entity = _video.Find(id); entity.IsDel = true; }
public ActionResult Edit(int id) { var objVideo = _videoRepository.Find(id); return(Json(RenderViewToString("~/Areas/Admin/Views/Video/_Edit.cshtml", objVideo), JsonRequestBehavior.AllowGet)); }