public InterviewsController(MyContext myContext, IConfiguration config, UserRepository repo, InterviewRepository _repoInterview)
 {
     _context            = myContext;
     _configuration      = config;
     _repo               = repo;
     this._repoInterview = _repoInterview;
 }
Example #2
0
 public UnitOfWork(string connection)
 {
     PersonRepository            = new PersonRepository(new DbConnectionFactory(connection));
     LanguageRepository          = new LanguageRepository(new DbConnectionFactory(connection));
     ProfessionalSkillRepository = new ProfessionalSkillRepository(new DbConnectionFactory(connection));
     EducationRepository         = new EducationRepository(new DbConnectionFactory(connection));
     JobRepository            = new JobRepository(new DbConnectionFactory(connection));
     TypeJobRepository        = new TypeJobRepository(new DbConnectionFactory(connection));
     WorkExpireanceRepository = new WorkExpireanceRepository(new DbConnectionFactory(connection));
     InterviewRepository      = new InterviewRepository(new DbConnectionFactory(connection));
     LanguagesNameRepository  = new TypeLanguageRepository(new DbConnectionFactory(connection));
     LanguageLevelRepository  = new LanguageLevelRepository(new DbConnectionFactory(connection));
     TypeJobsNameRepository   = new TypeJobsNameRepository(new DbConnectionFactory(connection));
 }
Example #3
0
        public virtual async Task <bool> AssignCandidatesToInterview(int interviewId, string candidateIdsList)
        {
            try
            {
                InterviewRepository   iRepo   = new InterviewRepository();
                IntervieweeRepository iCRepo  = new IntervieweeRepository();
                TemporaryCVRepository tCVRepo = new TemporaryCVRepository();
                var idList      = candidateIdsList.Trim().Split(',');
                int newCapacity = 0;
                foreach (var tempId in idList)
                {
                    if (tempId != null && tempId.Trim() != "")
                    {
                        int id = Int32.Parse(tempId);

                        await iCRepo.Insert(new Interviewee
                        {
                            InterviewId   = interviewId,
                            IntervieweeId = id
                        });

                        TemporaryCV temp = tCVRepo.Get(id).Result;
                        temp.Status = "assigned";
                        await tCVRepo.Update(temp, id);

                        newCapacity += 1;
                    }
                }

                Interview tempInter = iRepo.Get(interviewId).Result;
                tempInter.NumberOfCandidatesAssigned += newCapacity;
                await iRepo.Update(tempInter, tempInter.InterviewId);

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }