public async Task <IActionResult> DeleteBlog(int id) { if (ModelState.IsValid) { var model = new BlogPostModel(); try { var title = await model.DeleteAsync(id); model.Response = new ResponseModel($"Blog {title} successfully deleted.", ResponseType.Success); return(RedirectToAction("Index")); } catch (Exception ex) { model.Response = new ResponseModel("Blog deletion failed.", ResponseType.Failure); _logger.LogError(ex.Message); } } return(RedirectToAction("Index")); }