public IActionResult Delete(PostDeleteVm postVm) { try { _postService.DeletePost(postVm); return(RedirectToAction("Index")); } catch (Exception ex) { ViewData["Erro"] = ex.Message; return(View("_Erro")); } }
public void DeletePost(PostDeleteVm postVm) { var post = this._repository.GetById(postVm.PostId); this._repository.Delete(post); }