Exemple #1
0
 public void AddSVideo(SVideo svideo)
 {
     SVideos.Add(svideo);
     SaveChanges();
 }
Exemple #2
0
 public void RemoveSVideo(SVideo svideo)
 {
     SVideos.Remove(svideo);
     SaveChanges();
 }
        public ActionResult EditSVideo(SVideo svideo, HttpPostedFileBase movie)
        {
            if (ModelState.IsValid && movie != null && svideo.Name != "")
            {
                SVideo SVideo = null;

                if (svideo.Id == 0)
                {
                    SVideo = svideo;
                    SVideo.VideoMimeType = movie.ContentType;
                    SVideo.VideoData = new byte[movie.ContentLength];
                    movie.InputStream.Read(SVideo.VideoData, 0, movie.ContentLength);
                    context.AddSVideo(SVideo);
                }
                else
                {
                    SVideo = context.GetSVideoById(svideo.Id);
                    SVideo.VideoMimeType = movie.ContentType;
                    SVideo.VideoData = new byte[movie.ContentLength];
                    movie.InputStream.Read(SVideo.VideoData, 0, movie.ContentLength);
                }

                context.SaveChanges();
            }
            return Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString());
        }