public ActionResult DeleteArtigo(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { postRepos.Excluir(p => p.Id == id); postRepos.SalvarTodos(); return(RedirectToAction("AlternateIndex")); } }
public void TesteExcluir() { Guid id = new Guid("a758d194-7a19-408e-81e8-c146fe19d1d6"); try { PostRepositorio postRepositorio = new PostRepositorio("Server=" + this.server + ";Database=" + this.database + ";Uid=" + this.uid + ";Pwd=" + this.pwd + ";SslMode=" + this.sslmode + ""); postRepositorio.Excluir(id); } catch (Exception e) { Console.WriteLine(e); throw; } }