public ActionResult Create()
        {
            var viewModel = new CreateVideoViewModel();
            ViewBag.ParentId = new SelectList(_context.Videos, "Id", "Name");

            return View(viewModel);
        }
        public ActionResult Create(CreateVideoViewModel form, HttpPostedFileBase videoFileName, HttpPostedFileBase pictureFileName)
        {
            if (ModelState.IsValid)
            {
                if (videoFileName != null)
                {
                    form.Video.VideoFileName = FileServices.UploadFile(videoFileName, Server, "~/Content/Videos");
                   
                }

                if (pictureFileName != null)
                {
                    form.Video.PicFileName = FileServices.UploadFile(pictureFileName, Server, "~/Content/Videos");
                }

                var video = new Video
                {
                    Name = form.Video.Name,
                    PicFileName = form.Video.PicFileName,
                    VideoFileName = form.Video.VideoFileName,
                    ParentId = form.ParentId,
                    Description = form.Video.Description

                };

                _context.Videos.Add(video);
                _context.SaveChanges();

                return RedirectToAction("Index");
            }

            ViewBag.ParentId = new SelectList(_context.Videos, "Id", "Name", form.Video.ParentId);
            return View(form);
        }
        public ActionResult EditVideo(int id)
        {
            var viewModel = new CreateVideoViewModel();
            var video = _context.Videos.Find(id);

            if (video == null)
            {
                return HttpNotFound();
            }
            viewModel.Name = video.Name;
            viewModel.ParentId = video.ParentId;
            viewModel.PicFileName = video.PicFileName;
            viewModel.VideoFileName = video.VideoFileName;
            viewModel.Description = video.Description;


            ViewBag.ParentId = new SelectList(_context.Videos, "Id", "Name", video.ParentId);
            return View(viewModel);
        }
        public ActionResult EditVideo(CreateVideoViewModel model)
        {
            if (ModelState.IsValid)
            {
                var video = _context.Videos.FirstOrDefault(i => i.Id == model.Id);
                if (video != null)
                {
                    video.Name = model.Name;
                    video.ParentId = model.ParentId;
                    video.PicFileName = model.PicFileName;
                    video.VideoFileName = model.VideoFileName;
                    video.Description = model.Description;
                    _context.Entry(video).State = EntityState.Modified;
                }

                _context.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.ParentId = new SelectList(_context.Videos, "Id", "Name", model.ParentId);
            return View(model);
        }