Exemple #1
0
 public ActionResult <IEnumerable <Department> > Get()
 {
     using (var db = new DesafioDbContext())
     {
         return(db.Departments);
     }
 }
Exemple #2
0
 public ActionResult <Employee> Get(int id)
 {
     using (var db = new DesafioDbContext())
     {
         return(db.Employees.First(e => e.id == id));
     }
 }
Exemple #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);
     }
 }
Exemple #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);
        }
Exemple #8
0
 public void Post([FromBody] Employee e)
 {
     using (var db = new DesafioDbContext())
     {
         db.Employees.Add(e);
     }
 }
Exemple #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());
        }
Exemple #10
0
 public FamiliaRepository(DesafioDbContext context)
 {
     _context = context;
 }
Exemple #11
0
 public UserRepository(DesafioDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Exemple #12
0
 protected Repository(DesafioDbContext db)
 {
     Db    = db;
     DbSet = db.Set <TEntity>();
 }
Exemple #13
0
 public StatusService(DesafioDbContext context)
 {
     _context = context;
 }
 public TurmaRepository(DesafioDbContext context) : base(context)
 {
 }
 public PhoneRepository(DesafioDbContext ctx)
 {
     _contextDb = ctx;
 }
Exemple #16
0
 public AlunoRepository(DesafioDbContext context) : base(context)
 {
 }
 public PessoasRepository(DesafioDbContext context)
 {
     _context = context;
 }
Exemple #18
0
 public UsuarioRepository(DesafioDbContext context) : base(context)
 {
 }
 public EscolaRepository(DesafioDbContext context) : base(context)
 {
 }
Exemple #20
0
 public TransacoesRepository(DesafioDbContext context)
 {
     _context = context;
 }
Exemple #21
0
 public PedidoService(DesafioDbContext context)
 {
     _context = context;
 }
Exemple #22
0
 public UsuarioRepository(DesafioDbContext ctx)
 {
     _contextDb = ctx;
 }