private tbCategoriaNoticia CastCategoriaNoticia(CategoriaNoticiaEntity categoriaNoticia) { tbCategoriaNoticia tb = new tbCategoriaNoticia(); tb.DataUltimaAlteracao = categoriaNoticia.DataUltimaAlteracao; tb.id = categoriaNoticia.id; tb.Nome = categoriaNoticia.Nome; tb.responsavelUltimaAlteracao = categoriaNoticia.responsavelUltimaAlteracao; return(tb); }
public bool DeletaCategoriaNoticia(int id) { try { using (var context = new CirculoNegocioEntities()) { tbCategoriaNoticia delete = (from p in context.tbCategoriaNoticias where p.id == id select p).First(); context.tbCategoriaNoticias.DeleteObject(delete); context.SaveChanges(); } return(true); } catch (Exception) { return(false); } }