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);
        }
예제 #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            await _postsServicio.DeletePost(id);

            return(RedirectToAction("Index"));
        }
예제 #3
0
        public JsonResult DeletePost(int id, int userId)
        {
            var d = _postService.DeletePost(id, userId);

            return(Json(d, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public IActionResult OnPost([FromRoute] int id)
        {
            _postsService.DeletePost(id);

            return(RedirectToPage("./Posts"));
        }