private tbBannerBusca CastBannerBusca(BannerBuscaEntity banner) { tbBannerBusca tb = new tbBannerBusca(); tb.Ativo = banner.Ativo; tb.dataAte = banner.dataAte; tb.dataDe = banner.dataDe; tb.estado = banner.estado; tb.idCliente = banner.idCliente; tb.idCategoria = banner.idCategoria; tb.responsavelUltimaAlteracao = banner.responsavelUltimaAlteracao; tb.DataUltimaAlteracao = banner.DataUltimaAlteracao; return(tb); }
public void AtualizaFilePathImagemBannerBusca(int idBannerBusca, string filePath) { try { using (var context = new CirculoNegocioEntities()) { tbBannerBusca banner = (from p in context.tbBannerBuscas where p.id == idBannerBusca select p).First(); banner.imagemFilePath = filePath; context.SaveChanges(); } } catch (Exception) { throw; } }
public bool DeletaBannerBusca(int id) { try { using (var context = new CirculoNegocioEntities()) { tbBannerBusca delete = (from p in context.tbBannerBuscas where p.id == id select p).First(); context.tbBannerBuscas.DeleteObject(delete); context.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
public int InsereBannerBusca(BannerBuscaEntity banner) { int idBannerBusca = 0; try { using (var context = new CirculoNegocioEntities()) { tbBannerBusca tb = CastBannerBusca(banner); context.tbBannerBuscas.AddObject(tb); context.SaveChanges(); idBannerBusca = tb.id; } return(idBannerBusca); } catch (Exception) { return(0); } }