Beispiel #1
0
 public ActionResult <IEnumerable <Department> > Get()
 {
     using (var db = new DesafioDbContext())
     {
         return(db.Departments);
     }
 }
Beispiel #2
0
 public ActionResult <Employee> Get(int id)
 {
     using (var db = new DesafioDbContext())
     {
         return(db.Employees.First(e => e.id == id));
     }
 }
Beispiel #3
0
 public ActionResult <IEnumerable <Employee> > Get()
 {
     using (var db = new DesafioDbContext())
     {
         return(db.Employees);
     }
 }
 public ActionResult <Job> Get(int id)
 {
     using (var db = new DesafioDbContext())
     {
         return(db.Jobs.First(j => j.id == id));
     }
 }
 public ActionResult <IEnumerable <Job> > Get()
 {
     using (var db = new DesafioDbContext())
     {
         return(db.Jobs);
     }
 }
Beispiel #6
0
 public ActionResult <Department> Get(int id)
 {
     using (var db = new DesafioDbContext())
     {
         return(db.Departments.First(d => d.id == id));
     }
 }
        public RequestResponse InsertDb()
        {
            var response = new RequestResponse();

            try
            {
                using (var db = new DesafioDbContext())
                {
                    this.dataInclusao = DateTime.Now;
                    if (db.CheckIfPessoaValid(this))
                    {
                        db.Pessoa.Add(this);
                        db.SaveChanges();
                        response.message       = "Pessoa cadastrado com successo";
                        response.message      += " com Id: ";
                        response.message      += this.pessoaId;
                        response.dateInsertion = this.dataInclusao.ToLongDateString();
                    }
                    else
                    {
                        response.message  = "Houve um erro de cadastro" + Environment.NewLine;
                        response.message += "Esse item ja existe.";
                    }
                }
            }
            catch (Exception ex)
            {
                response.message  = "Houve um erro de cadastro" + Environment.NewLine;
                response.message += ex.Message;
            }

            return(response);
        }
Beispiel #8
0
 public void Post([FromBody] Employee e)
 {
     using (var db = new DesafioDbContext())
     {
         db.Employees.Add(e);
     }
 }
Beispiel #9
0
        public List <CandidatureResult> Ranking(int idVaga)
        {
            var ranking = new List <CandidatureResult>();

            using (var db = new DesafioDbContext())
            {
                List <Candidatura> listCand = db.Candidatura.Where(c => c.id_vaga == idVaga).ToList();
                var vag = db.Vaga.FirstOrDefault(p => p.vagaId == idVaga);
                foreach (var can in listCand)
                {
                    var pers       = db.Pessoa.FirstOrDefault(p => p.pessoaId == can.id_pessoa);
                    var resultCand = new CandidatureResult(pers, vag);
                    ranking.Add(resultCand);
                }
            }

            return(ranking.OrderByDescending(c => c.score).ToList());
        }
Beispiel #10
0
 public FamiliaRepository(DesafioDbContext context)
 {
     _context = context;
 }
Beispiel #11
0
 public UserRepository(DesafioDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Beispiel #12
0
 protected Repository(DesafioDbContext db)
 {
     Db    = db;
     DbSet = db.Set <TEntity>();
 }
Beispiel #13
0
 public StatusService(DesafioDbContext context)
 {
     _context = context;
 }
 public TurmaRepository(DesafioDbContext context) : base(context)
 {
 }
Beispiel #15
0
 public PhoneRepository(DesafioDbContext ctx)
 {
     _contextDb = ctx;
 }
Beispiel #16
0
 public AlunoRepository(DesafioDbContext context) : base(context)
 {
 }
 public PessoasRepository(DesafioDbContext context)
 {
     _context = context;
 }
Beispiel #18
0
 public UsuarioRepository(DesafioDbContext context) : base(context)
 {
 }
 public EscolaRepository(DesafioDbContext context) : base(context)
 {
 }
Beispiel #20
0
 public TransacoesRepository(DesafioDbContext context)
 {
     _context = context;
 }
Beispiel #21
0
 public PedidoService(DesafioDbContext context)
 {
     _context = context;
 }
Beispiel #22
0
 public UsuarioRepository(DesafioDbContext ctx)
 {
     _contextDb = ctx;
 }