public void Eliminar() { try { using (var db = new ModeloCONCURSO()) { db.Entry(this).State = EntityState.Deleted; db.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <CONCURSO> Listar() { var proyecto = new List <CONCURSO>(); try { using (var db = new ModeloCONCURSO()) { proyecto = db.CONCURSO.Include("CATEGORIAS").ToList(); } } catch (Exception ex) { throw new Exception(ex.Message); } return(proyecto); }
public List <CONCURSO> ListarB() { var proyecto = new List <CONCURSO>(); try { using (var db = new ModeloCONCURSO()) { proyecto = db.CONCURSO.Include("CATEGORIAS").Where(x => x.CATEGORIAS.NOMBRECATEGORIA.Equals("B")).ToList(); } } catch (Exception ex) { throw new Exception(ex.Message); } return(proyecto); }
public List <CATEGORIAS> Listar() { var categorias = new List <CATEGORIAS>(); try { using (var db = new ModeloCONCURSO()) { categorias = db.CATEGORIAS.ToList(); } } catch (Exception ex) { throw new Exception(ex.Message); } return(categorias); }
public CONCURSO Obtener(int id) { var proyecto = new CONCURSO(); try { using (var context = new ModeloCONCURSO()) { proyecto = context.CONCURSO.Include("CATEGORIAS") .Where(x => x.IDCONCURSO == id) .Single(); } } catch (Exception e) { throw new Exception(e.Message); } return(proyecto); }
public CATEGORIAS Obtener(int id) { var cate = new CATEGORIAS(); try { using (var context = new ModeloCONCURSO()) { cate = context.CATEGORIAS .Where(x => x.IDCATEGORIA == id) .Single(); } } catch (Exception e) { throw new Exception(e.Message); } return(cate); }
public void Guardar() { try { using (var db = new ModeloCONCURSO()) { if (this.IDCONCURSO > 0) { db.Entry(this).State = EntityState.Modified; } else { db.Entry(this).State = EntityState.Added; } db.SaveChanges(); } } catch (Exception) { throw; } }
public void Guardar() { try { using (var db = new ModeloCONCURSO()) { if (this.IDCATEGORIA > 0) { db.Entry(this).State = EntityState.Modified; } else { db.Entry(this).State = EntityState.Added; } db.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } }