コード例 #1
0
        public ActionResult EditVideoForm(long?id)
        {
            var            video = _videosRepository.GetVideoById(id);
            EditVideoModel evm   = EditVideoModel.EditVideoModalFromVideo(video);

            ViewBag.VideoType = GetVideoTypesAndSelect(evm.VideoType);

            return(PartialView(evm));
        }
コード例 #2
0
 public ActionResult EditVideoForm([Bind(Include = "VideoID,VideoName,VideoDescription,VideoType,CommentsEnabled,RatingEnabled")] EditVideoModel evm)
 {
     if (UsersHelper.LoggedInUserUsername(Session) == null)
     {
         return(null);
     }
     if (ModelState.IsValid)
     {
         var video = _videosRepository.GetVideoById(evm.VideoID);
         if (video == null)
         {
             return(null);
         }
         video.UpdateVideoFromEditVideoModel(evm);
         _videosRepository.UpdateVideo(video);
         ViewBag.Message = "Video has been successfully edited.";
         return(PartialView("MessageModal"));
     }
     ViewBag.VideoType = GetVideoTypesAndSelect(evm.VideoType);
     return(PartialView(evm));
 }