public async Task <IActionResult> Edit(int id, [Bind("CommentChannelId,ProfileId,Comment,NrLikes,NrDislikes")] CommentChannel commentChannel) { if (id != commentChannel.CommentChannelId) { return(NotFound()); } if (ModelState.IsValid) { try { commentChannelService.UpdateCommentChannel(commentChannel); } catch (DbUpdateConcurrencyException) { if (!commentChannelService.CommentChannelExists(commentChannel.CommentChannelId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProfileId"] = new SelectList(commentChannelService.GetAllProfiles(), "ProfileId", "ProfileId", commentChannel.ProfileId); return(View(commentChannel)); }
public async Task <IActionResult> Create([Bind("CommentChannelId,ProfileId,Comment,NrLikes,NrDislikes")] CommentChannel commentChannel) { if (ModelState.IsValid) { commentChannelService.Create(commentChannel); return(RedirectToAction(nameof(Index))); } ViewData["ProfileId"] = new SelectList(commentChannelService.GetAllProfiles(), "ProfileId", "ProfileId", commentChannel.ProfileId); return(View(commentChannel)); }
public void UpdateCommentChannel(CommentChannel commentChannel) { _repo.CommentChannel.Update(commentChannel); _repo.Save(); }
public void Create(CommentChannel commentChannel) { _repo.CommentChannel.Create(commentChannel); _repo.Save(); }