public async Task DeleteEntityTest() { var fakeRepositoryMock = new Mock <IPostsContext>(); fakeRepositoryMock.Setup(x => x.GetPostsList()).ReturnsAsync(cars); var postService = new PostsService(fakeRepositoryMock.Object); await postService.DeletePost(2); }
public async Task <ActionResult> DeleteConfirmed(int id) { await _postsServicio.DeletePost(id); return(RedirectToAction("Index")); }
public JsonResult DeletePost(int id, int userId) { var d = _postService.DeletePost(id, userId); return(Json(d, JsonRequestBehavior.AllowGet)); }
public IActionResult OnPost([FromRoute] int id) { _postsService.DeletePost(id); return(RedirectToPage("./Posts")); }