Пример #1
0
 public List <Participacao> Listar()
 {
     using (var db = new SistemaDeEventosContext())
     {
         return(db.Participacoes.ToList());
     }
 }
Пример #2
0
 public Evento ListarCateg(int categoria)
 {
     using (var db = new SistemaDeEventosContext())
     {
         return(db.Eventos.Where(x => x.IdCategoriaEvento == categoria).FirstOrDefault());
     }
 }
Пример #3
0
 public CategoriaEvento findById(int id)
 {
     using (var db = new SistemaDeEventosContext())
     {
         return(db.CategoriaEventos.Where(x => x.IdCategoriaEvento == id).FirstOrDefault());
     }
 }
Пример #4
0
 public List <CategoriaEvento> Listar()
 {
     using (var db = new SistemaDeEventosContext())
     {
         return(db.CategoriaEventos.ToList());
     }
 }
Пример #5
0
 public List <T> Listar()
 {
     using (var db = new SistemaDeEventosContext())
     {
         return(db.Set <T>().Where(x => !x.FlagExcluido).ToList());
     }
 }
Пример #6
0
 public List <Participacao> GetParticipanteByEvento(int idEvento)
 {
     using (var db = new SistemaDeEventosContext())
     {
         return(db.Participacoes.Where(x => x.IdEvento == idEvento).ToList());
     }
 }
Пример #7
0
 public Participacao findById(int id)
 {
     using (var db = new SistemaDeEventosContext())
     {
         return(db.Participacoes.Where(x => x.IdParticipacao == id).FirstOrDefault());
     }
 }
Пример #8
0
 public Evento ListarData(DateTime data)
 {
     using (var db = new SistemaDeEventosContext())
     {
         return(db.Eventos.Where(x => x.DataHoraInicio == data).FirstOrDefault());
     }
 }
 public Evento Obter(int id)
 {
     using (var db = new SistemaDeEventosContext())
     {
         db.Eventos.Include(x => x.IdCategoriaEventoNavigation).Include(x => x.IdEventoStatusNavigation).ToList();
         return(db.Eventos.Where(x => x.IdEvento == id).FirstOrDefault());
     }
 }
Пример #10
0
 public List <Evento> ListByData(DateTime data)
 {
     using (var db = new SistemaDeEventosContext())
     {
         db.Eventos.Include(x => x.IdCategoriaEventoNavigation).Include(x => x.IdEventoStatusNavigation).ToList();
         return(db.Eventos.Where(x => x.DataHoraInicio.Date == data.Date).ToList());
     }
 }
Пример #11
0
 public List <Evento> Listar()
 {
     using (var db = new SistemaDeEventosContext())
     {
         //assim se faz left join
         return(db.Eventos.Include(x => x.IdCategoriaEventoNavigation).Include(x => x.IdEventoStatusNavigation).ToList());
     }
 }
Пример #12
0
 public void Excluir(T modelo)
 {
     using (var db = new SistemaDeEventosContext())
     {
         modelo.FlagExcluido = true;
         Atualizar(modelo);
     }
 }
Пример #13
0
 public List <Evento> ListByCategoria(int categoria)
 {
     using (var db = new SistemaDeEventosContext())
     {
         db.Eventos.Include(x => x.IdCategoriaEventoNavigation).Include(x => x.IdEventoStatusNavigation).ToList();
         return(db.Eventos.Where(x => x.IdCategoriaEvento == categoria).ToList());
     }
 }
Пример #14
0
 public CategoriaEvento create(CategoriaEvento model)
 {
     using (var db = new SistemaDeEventosContext())
     {
         db.CategoriaEventos.Add(model);
         db.SaveChanges();
         return(model);
     }
 }
Пример #15
0
        public int LimiteVagas(int id)
        {
            using (var db = new SistemaDeEventosContext())
            {
                var limite = db.Eventos.Where(e => e.IdEvento == id).Select(e => e.LimiteVagas).First();

                return(limite);
            }
        }
Пример #16
0
 public Evento Inserir(Evento model)
 {
     using (var db = new SistemaDeEventosContext())
     {
         db.Eventos.Add(model);
         db.SaveChanges();
         return(model);
     }
 }
Пример #17
0
 public Participacao create(Participacao model)
 {
     using (var db = new SistemaDeEventosContext())
     {
         db.Participacoes.Add(model);
         db.SaveChanges();
         return(model);
     }
 }
Пример #18
0
 public Evento Inserir(Evento model)
 {
     using (var db = new SistemaDeEventosContext())
     {
         db.Eventos.Add(model);
         db.SaveChanges();
         db.Eventos.Include(x => x.IdCategoriaEventoNavigation).Include(x => x.IdEventoStatusNavigation).ToList();
         return(model);
     }
 }
Пример #19
0
 public Evento Atualizar(Evento model)
 {
     using (var db = new SistemaDeEventosContext())
     {
         db.Entry(model).State = EntityState.Modified;
         db.Eventos.Include(x => x.IdCategoriaEventoNavigation).Include(x => x.IdEventoStatusNavigation).ToList();
         db.SaveChanges();
         return(model);
     }
 }
Пример #20
0
        public int IncricoesEvento(int id)
        {
            using (var db = new SistemaDeEventosContext())
            {
                var incricoes = db.Participacoes.Include(p => p.IdEventoNavigation)
                                .Where(p => p.IdEvento == id)
                                .Count();

                return(incricoes);
            }
        }
Пример #21
0
        public bool delete(Participacao model)
        {
            using (var db = new SistemaDeEventosContext())
            {
                db.Entry(model).State = EntityState.Deleted;

                db.SaveChanges();

                return(true);
            }
        }
Пример #22
0
        public Participacao update(Participacao model)
        {
            using (var db = new SistemaDeEventosContext())
            {
                db.Entry(model).State = EntityState.Modified;

                db.SaveChanges();

                return(model);
            }
        }
Пример #23
0
        public CategoriaEvento update(CategoriaEvento model)
        {
            using (var db = new SistemaDeEventosContext())
            {
                db.Entry(model).State = EntityState.Modified;

                db.SaveChanges();

                return(model);
            }
        }
Пример #24
0
        public T Inserir(T modelo)
        {
            using (var db = new SistemaDeEventosContext())
            {
                db.ChangeTracker.AutoDetectChangesEnabled = false;

                db.Set <T>().Add(modelo);

                db.SaveChanges();

                return(modelo);
            }
        }
Пример #25
0
        public T Atualizar(T modelo)
        {
            using (var db = new SistemaDeEventosContext())
            {
                db.ChangeTracker.AutoDetectChangesEnabled = false;

                db.Entry(modelo).State = EntityState.Modified;

                db.SaveChanges();

                return(modelo);
            }
        }