public IActionResult OnPost(int blogDetailsId) { var blogData = _blogData.Delete(blogDetailsId); _blogData.Commit(); if (blogData == null) { return(RedirectToPage("./NotFound")); } TempData["Message"] = $"{blogData.Title} deleted"; return(RedirectToPage("./Index")); }
public async Task <ActionResult> OnPost(int blogId) { blog = blogData.GetById(blogId); if (blog == null) { return(RedirectToPage("./NotFound")); } blogData.Delete(blog); if (await blogData.Commit()) { TempData["Message"] = $"Blog Deleted!"; return(RedirectToPage("./List", new { blogTypeId = blog.blogTypeId })); } return(RedirectToPage("./NotFound")); }