public ActionResult AddNote(NoteViewModel note) { int videoId = note.VideoId; decimal time = note.Time; string userId = User.Identity.GetUserId(); Note n = new Note { //Color = note.Color, Content = note.Content, Share = note.Share, Time = time, Title = note.Title, VideoId = videoId }; try { this.noteService.AddNote(n, userId); } catch (ValidationException ex) { ExceptionBindingInMS.AddModelErrors(this.ModelState, ex); return(PartialView("_Notes")); } return(this.GetNotes(note.VideoId)); }
public ActionResult DeleteCategory(string categoryId) { string userID = User.Identity.GetUserId(); try { this.categoryService.DeleteCategoryById(categoryId, userID); } catch (ValidationException ex) { ExceptionBindingInMS.AddModelErrors(this.ModelState, ex); return(PartialView("_CategoryList")); } return(this.GetAllCategories()); }
public ActionResult DeleteVideo(string videoId) { Video k = null; string userId = User.Identity.GetUserId(); try { k = videoService.DeleteVideoById(videoId, userId); } catch (ValidationException ex) { ExceptionBindingInMS.AddModelErrors(this.ModelState, ex); throw new HttpException(400, "Bad Request"); } return(this.GetVideos(k.CategoryId.ToString())); }
public ActionResult DeleteNote(string noteId) { string userId = User.Identity.GetUserId(); Note note; try { note = this.noteService.DeleteNoteById(noteId, userId); } catch (ValidationException ex) { ExceptionBindingInMS.AddModelErrors(this.ModelState, ex); return(PartialView("_Notes")); } return(this.GetNotes(note.VideoId)); }
public ActionResult AddVideo([Bind(Exclude = "VideoId")] VideoViewModel video) { string userId = User.Identity.GetUserId(); Video videoEntity = new Video { YtId = video.YtId, Title = video.Title, ThumbUrl = video.ThumbNail, CategoryId = video.CategoryId }; try { this.videoService.AddVideo(videoEntity, userId); } catch (ValidationException ex) { ExceptionBindingInMS.AddModelErrors(this.ModelState, ex); return(View("_VideosWindow")); } return(this.GetVideos(videoEntity.CategoryId.ToString())); }
public ActionResult AddCategory([Bind(Exclude = "CategoryId")] CategoryViewModel category) { string userId = User.Identity.GetUserId(); Category categoryEntity = new Category { Name = category.Name, ApplicationUserId = userId }; try { this.categoryService.AddCategory(categoryEntity); } catch (ValidationException ex) { ExceptionBindingInMS.AddModelErrors(this.ModelState, ex); return(View("_CategoryList")); } category.CategoryId = categoryEntity.CategoryId; return(PartialView("_Category", category)); }