public async Task <IActionResult> Edit(int id, [Bind("CommentVideoId,VideosId,Comment,NrLikes,NrDislikes")] CommentVideo commentVideo) { if (id != commentVideo.CommentVideoId) { return(NotFound()); } if (ModelState.IsValid) { try { commentVideoService.UpdateCommentVideo(commentVideo); } catch (DbUpdateConcurrencyException) { if (!commentVideoService.CommentVideoExists(commentVideo.CommentVideoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["VideosId"] = new SelectList(commentVideoService.GetAllVideos(), "VideosId", "VideosId", commentVideo.VideosId); return(View(commentVideo)); }
public async Task <IActionResult> Create([Bind("CommentVideoId,VideosId,Comment,NrLikes,NrDislikes")] CommentVideo commentVideo) { if (ModelState.IsValid) { commentVideoService.Create(commentVideo); return(RedirectToAction(nameof(Index))); } ViewData["VideosId"] = new SelectList(commentVideoService.GetAllVideos(), "VideosId", "VideosId", commentVideo.VideosId); return(View(commentVideo)); }
public void UpdateCommentVideo(CommentVideo commentVideo) { _repo.CommentVideo.Update(commentVideo); _repo.Save(); }
public void Create(CommentVideo commentVideo) { _repo.CommentVideo.Create(commentVideo); _repo.Save(); }