Ejemplo n.º 1
0
 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"));
     }
 }
Ejemplo n.º 2
0
        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;
            }
        }