public IActionResult AddVideo(VideoVM model) { VideoVM movie = new VideoVM(); movie.movies = _context.Movies.Where(x => x.IsDeleted == false).ToList(); if (ModelState.IsValid) { MovieVideos movieVideos = new MovieVideos(); movieVideos.VideoPath = model.videopath; movieVideos.MovieID = model.movieid; _context.MovieVideos.Add(movieVideos); _context.SaveChanges(); return(View(movie)); } else { return(View(movie)); } }
public ActionResult TabVideo(VideoVM obj, int id = 0) { try { if (ModelState.IsValid) { // save table SectionContent obj.SectionContents.PositionGalleryID = obj.positionVideo; // get id new record save //obj.Video.SectionContentID = secContentDAO.AddItem(vm.SectionContents); // save table video obj.Video.PositionID = obj.positionVideo; obj.Video.Published = obj.isPublish; obj.Video.Deleted = obj.isDeleted; obj.Video.isShowHome = obj.isHome; obj.Video.Fly_SectionContent = obj.SectionContents; _repository.Add(obj.Video); return(RedirectToAction("Index")); } else { return(View()); } } catch (Exception e) { return(View(e.Message)); } }
public void AddVideo(VideoVM v) { lock (LockThis) { using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + DatabaseFile)) { using (SQLiteCommand command = new SQLiteCommand()) { command.Connection = connection; connection.Open(); SQLiteHelper helper = new SQLiteHelper(command); Dictionary <string, object> dic = new Dictionary <string, object> { ["Title"] = v.Title, ["Link"] = v.Link, ["PubDate"] = v.PubDate, ["Description"] = v.Description, ["MagnetLink"] = v.MagnetLink, ["Author"] = v.Author, ["Guid"] = v.Guid, ["Category"] = v.Category, ["CategoryLink"] = v.CategoryLink, ["Hash"] = v.Hash }; helper.Insert("VideoList", dic); connection.Close(); } } } }
public PartialViewResult SingleHero() { VideoVM VM = new VideoVM(); VM.videoList = db.tbl_video.OrderByDescending(x => x.VideoId).Take(1).ToList(); return(PartialView(VM)); }
public ActionResult Create(VideoVM obj, int id = 0) { try { // save table SectionContent obj.SectionContents.PositionGalleryID = obj.positionVideo; // save table video obj.Video.PositionID = obj.positionVideo; obj.Video.Published = obj.isPublish; obj.Video.Deleted = obj.isDeleted; obj.Video.isShowHome = obj.isHome; obj.Video.Fly_SectionContent = obj.SectionContents; if (Session["idxu"] != null && Session["idxu"].ToString().Length > 0) { obj.Video.CreatedByID = int.Parse(Session["idxu"].ToString()); } _repository.Add(obj.Video); return(RedirectToAction("Index")); } catch (Exception e) { return(View(e.Message)); } }
public PartialViewResult Heros() { VideoVM VM = new VideoVM(); VM.videoList = db.tbl_video.OrderByDescending(x => x.Title).Take(4).ToList(); return(PartialView(VM)); }
public async Task InitVideoVM() { // default video folder if (App.LocalSettings.ContainsKey("DefaultVideoFolder")) { StorageFolder customDefaultVideoFolder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync( App.LocalSettings["DefaultVideoFolder"].ToString()); VideoVM = new VideoLibraryViewModel(customDefaultVideoFolder); } else { VideoVM = new VideoLibraryViewModel(KnownVLCLocation.VideosLibrary); } await VideoVM.GetMedia(); MusicLibraryVm = Locator.MusicLibraryVM; await MusicLibraryVm.Initialize(); #if NETFX_CORE ExternalStorageVM = new ExternalStorageViewModel(); await ExternalStorageVM.Initialize(); #endif }
public ActionResult VideoPage(int?page = 1) { VideoVM VM = new VideoVM(); VM.videos = (IPagedList <tbl_video>)db.tbl_video.OrderByDescending(x => x.VideoId).ToPagedList((int)page, 8); return(View(VM)); }
public ActionResult EditEventClip(VideoVM obj, int id) { try { // save table SectionContent //obj.Video.Fly_SectionContent.PositionGalleryID = obj.positionVideo; // get id new record save //obj.Video.SectionContentID = secContentDAO.AddItem(vm.SectionContents); // save table video obj.Video.PositionID = obj.positionVideo; obj.Video.Published = obj.isPublish; obj.Video.Deleted = obj.isDeleted; obj.Video.isShowHome = obj.isHome; obj.Video.Fly_SectionContent.SectionContentID = obj.Video.SectionContentID.GetValueOrDefault(); obj.Video.Fly_SectionContent.PositionGalleryID = obj.positionVideo; obj.Video.Fly_SectionContent.ProductID = obj.Video.ProductId; _repository.Edit(obj.Video); return(RedirectToAction("EventClip")); } catch (Exception e) { return(View(e.InnerException.Message)); } }
public ActionResult CreateEventClip(VideoVM obj, int id = 0) { try { // save table SectionContent obj.SectionContents.PositionGalleryID = _repositoryPos.GetItemByPosName(PositionTab.EventClip).PositionGalleryID; // save table video obj.Video.PositionID = obj.SectionContents.PositionGalleryID; obj.Video.Published = obj.isPublish; obj.Video.Deleted = obj.isDeleted; obj.Video.CreatedOn = DateTime.Now; obj.Video.isShowHome = obj.isHome; obj.Video.Fly_SectionContent = obj.SectionContents; if (Session["idxu"] != null && Session["idxu"].ToString().Length > 0) { obj.Video.CreatedByID = int.Parse(Session["idxu"].ToString()); } _repository.Add(obj.Video); return(RedirectToAction("EventClip")); } catch (Exception e) { return(View(e.InnerException.Message)); } }
public void AddVideoWithCheck(VideoVM v) { if (!VideoExisted(v)) { AddVideo(v); LogUtil.Log(string.Format("Video [{0}] is added to database.", v.Title)); } }
public IActionResult AddVideo() { VideoVM model = new VideoVM(); model.movies = _context.Movies.Where(x => x.IsDeleted == false).ToList(); return(View(model)); }
// GET: /Videos/ public ActionResult Index() { VideoVM indexVM = new VideoVM(); indexVM.AllVideos = db.Videos.ToList(); indexVM.CurrentVideos = db.CurrentVideo.Include("CurrentVideo").FirstOrDefault(); return(View(indexVM)); }
public VideoV(VideoVM vm) { InitializeComponent(); this.vm = vm; DataContext = this.vm; WindowsFormsHost1.Child = this.vm.Panel; Trace.WriteLine("~~~~~~~~~~~~~~~~Video View CREATED~~~~~~~~~~~~~~~~~~~"); }
/// <summary> /// To add a new Video /// </summary> /// <param name="video"></param> public void AddVideo(VideoVM video) { var movie = new Video { VideoDescription = video.VideoDescription, VideoName = video.VideoName, CategoryId = video.CategoryId, VideoPath = video.VideoPath, VideoSize = video.VideoSize }; _videoRepository.AddVideo(movie); }
/// <summary> /// 编辑 /// </summary> /// <param name="_VideoVM"></param> /// <returns></returns> public ActionResult Edit(VideoVM vm) { vm.Video = _videoService.GetById(vm.Id) ?? new Video(); vm.ImgInfo = _imageService.GetById(vm.Video.ImageInfoId) ?? new ImageInfo(); vm.Belongs = _belongService.GetAll(); vm.VideoClasses = _videoClassService.GetAll(); return(View(vm)); }
public ActionResult Videos() { VideoBL videoBL = new VideoBL(); VideoVM videoList = new VideoVM(); videoList.videos = videoBL.GetVideos(); videoList.videos.Reverse(); return(View(videoList)); }
private void MenuItemCopyMagnetLink2_Click(object sender, RoutedEventArgs e) { VideoVM v = this.view.ConfigManageTab.SelectedVideo; if (v != null) { Copy2Clipboard(v.MagnetLink); } }
public ActionResult Add() { VideoVM model = new VideoVM() { Categories = _VideoCategoryService.GetActive(), }; return(View(model)); }
public ActionResult List() { VideoVM model = new VideoVM() { Videos = _VideoService.GetActive(), Categories = _VideoCategoryService.GetActive() }; return(View(model)); }
public async Task <int> Add(VideoVM entity) { var sql = "INSERT INTO Video (Name, Path, CategoryId, IsCorrect) Values (@Name, @Path, @CategoryId, @IsCorrect);"; using (var connection = new SqlConnection(_configuration.GetConnectionString("DefaultConnection"))) { connection.Open(); var affectedRow = await connection.ExecuteAsync(sql, entity.VideoModel); return(affectedRow); } }
public ActionResult ListByCategory(int id) { VideoVM model = new VideoVM() { Videos = _VideoService.GetActive().Where(x => x.VideoCategoryID == id).ToList(), Categories = _VideoCategoryService.GetActive(), CategoryName = _VideoCategoryService.GetByID(id).Name, }; return(View(model)); }
public ActionResult Add(VideoVM _VideoVM, HttpPostedFileBase videoFile) { string fileName = Path.GetFileName(videoFile.FileName); videoFile.SaveAs(Server.MapPath("~/Content/VideoFiles/" + fileName)); _VideoVM.Video.UserID = _UserService.GetByDefault(x => x.UserName == User.Identity.Name).ID; _VideoVM.Video.Url = "~/Content/VideoFiles/" + fileName; _VideoVM.Video.Name = videoFile.FileName; _VideoVM.Video.VideoCategoryID = _VideoCategoryService.GetByDefault(x => x.Name == _VideoVM.CategoryName).ID; _VideoService.Add(_VideoVM.Video); return(Redirect("/SysAdmin/Video/List")); }
public ActionResult List(int page = 1) { var otherPageSEOModel = _otherPageSeoService.Get(o => o.Page == "Video"); ViewBag.Keyword = otherPageSEOModel.Keyword; ViewBag.Description = otherPageSEOModel.Description; ViewBag.MetaData = otherPageSEOModel.MetaData; var VideoVM = new VideoVM(); VideoVM.PagingItems = _projectImageService.Page(p => p.Status == true && p.Deleted == false && p.Type == 2, p => p.ZOrder, page, ItemPerPage, true); VideoVM.ProjectImages = VideoVM.PagingItems.Entities; return(View(VideoVM)); }
public ActionResult DeleteVideo(int id) { VideoBL videoBL = new VideoBL(); List <Video> postList = videoBL.GetVideos(); Video video = postList.Where(u => u.VideoId == id).Single(); videoBL.DeleteVideo(video); VideoVM v = new VideoVM(); v.videos = videoBL.GetVideos(); v.videos.Reverse(); return(RedirectToAction("Videos", "Home", v)); }
public async Task <IActionResult> AddVideo([FromBody] VideoVM video) { var authorizationResult = await _authorizationService .AuthorizeAsync(User, video, "AddVideoPolicy"); if (authorizationResult.Succeeded) { VideoRepository.Videos.Add(video); return(Ok()); } else { return(new ForbidResult()); } }
/// <summary> /// Update Video Details /// </summary> /// <param name="video"></param> public void UpdateVideoDetails(VideoVM videoVM) { var video = new Video(); if (video != null) { video.VideoName = videoVM.VideoName; video.Id = videoVM.VideoId; video.VideoDescription = videoVM.VideoDescription; video.VideoPath = videoVM.VideoPath; video.VideoSize = videoVM.VideoSize; video.CategoryId = videoVM.CategoryId; } _videoRepository.UpdateVideoDetails(video); }
private async void MenuItemDownloadMagnetLink_Click(object sender, RoutedEventArgs e) { this.view.ConfigManageTab.SetStatus(ConfigManageTabVM.OpStatus.BUSY); VideoVM v = this.view.ConfigManageTab.SelectedResult; if (v != null) { if (await DownloadVideo(v.MagnetLink)) { this.db.AddVideoWithCheck(v); v.Downloaded = true; } } this.view.ConfigManageTab.SetStatus(ConfigManageTabVM.OpStatus.IDLE); }
private async void MenuItemDownloadAllMagnetLink2_Click(object sender, RoutedEventArgs e) { this.view.ConfigManageTab.SetStatus(ConfigManageTabVM.OpStatus.BUSY); ObservableCollection <VideoVM> list = this.view.ConfigManageTab.UpdateList; for (int ii = list.Count - 1; ii >= 0; ii--) { VideoVM item = list[ii]; if (await DownloadVideo(item.MagnetLink)) { this.db.AddVideoWithCheck(item); list.Remove(item); } } this.view.ConfigManageTab.SetStatus(ConfigManageTabVM.OpStatus.IDLE); }
/// <summary> /// 列表 /// </summary> /// <param name="_VideoVM"></param> /// <param name="pn"></param> /// <returns></returns> public ActionResult List(VideoVM _VideoVM, int pn = 1) { int totalCount, pageIndex = pn, pageSize = PagingConfig.PAGE_SIZE; var list = _videoService.GetManagerList(_VideoVM.QueryName, _VideoVM.QueryClassId, pageIndex, pageSize, out totalCount); var paging = new Paging <Video>() { Items = list, Size = PagingConfig.PAGE_SIZE, Total = totalCount, Index = pn, }; _VideoVM.Paging = paging; return(View(_VideoVM)); }