Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 public void InsertVideo(VideoModel video)
 {
     var data = new VideoCode()
     {
         gads = video.Gads,
         player = video.Player
     };
     _dataContext.VideoCodes.InsertOnSubmit(data);
     _dataContext.SubmitChanges();
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 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);
 }