public async Task <string> DeleteComment(DeleteCommentInputDto deleteinput) { var result = CommentRepository.Delete(deleteinput.CommentId); await CommentRepository.Save(); return(result); }
public async Task <IActionResult> DeleteComment([FromBody] DeleteCommentInputDto deleteinput) { if (!ModelState.IsValid) { return(BadRequest()); } var result = await CommentServise.DeleteComment(deleteinput); return(Ok(result)); }
public async Task <IActionResult> OnGet(int id) { try { deleteComment = new DeleteCommentInputDto() { CommentId = id }; var result = await commentService.DeleteComment(deleteComment); State = true; return(RedirectToPage("./Comment")); } catch (Exception e) { State = false; ViewData["Error"] = e.Message; return(Page()); } }