public ActionResult Edit(long id) { VideoSaveModel model = new VideoSaveModel(); model.Videos = objVideo.GetVideoByID(id); model.VideoAlbum = objVideoAlbum.GetVideoAlbumByID(model.Videos.VideoAlbumID); return(View(model)); }
public ActionResult Add(long id) { VideoSaveModel model = new VideoSaveModel(); utblVideo _vmodel = new utblVideo(); model.VideoAlbum = objVideoAlbum.GetVideoAlbumByID(id); model.Videos = _vmodel; return(View(model)); }
public ActionResult Edit(VideoSaveModel model, HttpPostedFileBase docFile) { utblVideo vid = new utblVideo(); vid = objVideo.GetVideoByID(model.Videos.VideoID); string PrvPath = vid.VideoFilePathDraft; string file_result = ""; var validData = true; if (docFile != null) { string fileResult = FileTypeCheck.IsValidFile(docFile, "Video"); if (!fileResult.Equals("Success")) { ModelState.AddModelError("FileErr", fileResult); validData = false; } else { file_result = SaveFile(docFile, model.Videos.VideoAlbumID); model.Videos.VideoFilePathDraft = FileUrl + "/Videos/" + file_result; if (file_result.Contains("Error")) { TempData["ErrMsg"] = file_result; return(View(model)); } } } if (ModelState.IsValid && validData) { //model.Videos.VideoAlbumID = model.VideoAlbum.VideoAlbumID; model.Videos.TransDate = DateTime.Now; model.Videos.UserID = User.Identity.Name; string result = objVideo.SaveVideo(model.Videos); if (result.Contains("Success")) { if (file_result != "") { DeleteFile(PrvPath); } objSite.AddAuditLog("utblVideos", "Videos Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name); TempData["ErrMsg"] = result; return(RedirectToAction("index", "Video", new { Area = "Admin", AlbumID = model.Videos.VideoAlbumID })); } TempData["ErrMsg"] = result; } model.VideoAlbum = objVideoAlbum.GetVideoAlbumByID(model.Videos.VideoAlbumID); return(View(model)); }