public void UpdateVideo(VideoModel video)
 {
     VideoCode data = _dataContext.VideoCodes.Where(u => u.id == video.Id).SingleOrDefault();
     data.gads = video.Gads;
     data.player = video.Player;
     _dataContext.SubmitChanges();
 }
 public void InsertVideo(VideoModel video)
 {
     var data = new VideoCode()
     {
         gads = video.Gads,
         player = video.Player
     };
     _dataContext.VideoCodes.InsertOnSubmit(data);
     _dataContext.SubmitChanges();
 }
 public VideoModel GetVideoById(int videoId)
 {
     var query = from u in _dataContext.VideoCodes
                 where u.id == videoId
                 select u;
     var video = query.FirstOrDefault();
     var model = new VideoModel()
     {
         Id = videoId,
         Gads = video.gads,
         Player = video.player
     };
     return model;
 }
 public ActionResult Create(VideoModel video)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _repository.InsertVideo(video);
             return RedirectToAction("Index");
         }
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return View(video);
 }