Ejemplo n.º 1
0
        public async Task <ActionResult <IEnumerable <RecruiterDTO> > > GetAllRecruiters()
        {
            var query = from recruiter in _context.Recruiters
                        join recruiterUser in _context.Users on recruiter.UserId equals recruiterUser.Id
                        join company in _context.Companies on recruiter.CompanyId equals company.CompanyId
                        select new RecruiterDTO()
            {
                User    = AuthController.UserToDTO(recruiterUser),
                Company = CompaniesController.CompanyToDTO(company)
            };

            return(await query.ToListAsync());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <RecruiterDTO> > GetRecruiter(long companyId, string recruiterId)
        {
            var query = from recruiter in _context.Recruiters
                        join recruiterUser in _context.Users on recruiter.UserId equals recruiterUser.Id
                        join company in _context.Companies on recruiter.CompanyId equals company.CompanyId
                        where recruiter.CompanyId == companyId && recruiter.UserId == recruiterId
                        select new RecruiterDTO()
            {
                User    = AuthController.UserToDTO(recruiterUser),
                Company = CompaniesController.CompanyToDTO(company)
            };

            return(await query.FirstOrDefaultAsync());
        }
Ejemplo n.º 3
0
        private async Task <RecruiterDTO> RecruiterToDTO(Recruiter recruiterInfo)
        {
            var query = from recruiter in _context.Recruiters
                        join recruiterUser in _context.Users on recruiter.UserId equals recruiterUser.Id
                        join company in _context.Companies on recruiter.CompanyId equals company.CompanyId
                        where recruiter.CompanyId == recruiterInfo.CompanyId && recruiter.UserId == recruiterInfo.UserId
                        select new RecruiterDTO()
            {
                User    = AuthController.UserToDTO(recruiterUser),
                Company = CompaniesController.CompanyToDTO(company)
            };

            return(await query.FirstOrDefaultAsync());
        }