Example #1
0
        public void Setup()
        {
            _ministryPlatformService = new Mock <IMinistryPlatformService>();
            _configurationWrapper    = new Mock <IConfigurationWrapper>();
            _authenticationService   = new Mock <IAuthenticationRepository>();

            _fixture = new SkillsRepository(_authenticationService.Object, _configurationWrapper.Object, _ministryPlatformService.Object);
        }
Example #2
0
 public CreateVacancyController()
 {
     _jobOfferRepo      = new JobOffersRepository();
     _userRepo          = new UserRepository();
     _profRepo          = new ProfessionsRepository();
     _skillsRepository  = new SkillsRepository();
     _abilRepository    = new AbilitiesRepository();
     _abilSetRepository = new AbilitySetsRepository();
 }
Example #3
0
 public ApplianceController()
 {
     _appRepository        = new JobAppliancesRepository();
     _userRepository       = new UserRepository();
     _skillsRepository     = new SkillsRepository();
     _skillAttrsRepository = new SkillAttributesRepository();
     _abilRepository       = new AbilitiesRepository();
     _abilSetRepository    = new AbilitySetsRepository();
 }
Example #4
0
        public ActionResult DeleteSkillsCategory(Guid id)
        {
            var skillRepo = new SkillsRepository();

            skillRepo.DeleteSkillCategory(id);

            ViewBag.Mode = PageViewMode.EditSkillCategory;

            return(RedirectToAction("/", new { mode = "EditSkillCategory" }));
        }
Example #5
0
        public ActionResult AddSkillCategory(SkillsCategoryViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var model = new SkillCategory();
                viewModel.FillModel(model);
                var skillCatRepo = new SkillsRepository();
                skillCatRepo.AddSkillCategory(model);
            }

            return(RedirectToAction("/", new { mode = "EditSkillCategory" }));
        }
Example #6
0
        public void Setup()
        {
            _dbContextOptions = new DbContextOptionsBuilder <StudentifyDbContext>()
                                .UseInMemoryDatabase(databaseName: "StudentifyDb")
                                .Options;

            _context    = new StudentifyDbContext(_dbContextOptions);
            _repository = new SkillsRepository(_context,
                                               new SelectRepositoryBase <Skill>(_context),
                                               new InsertRepositoryBase <Skill>(_context),
                                               new UpdateRepositoryBase <Skill>(_context));
        }
Example #7
0
        public ActionResult AddSkill(SkillViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var model = new Skill();
                viewModel.FillModel(model);
                var skillRepo = new SkillsRepository();
                skillRepo.AddSkill(model, viewModel.SkillCategory);
            }

            return(new RedirectResult(Url.Action("Index", new { mode = "EditSkillCategory" }) + "#profskills"));
        }
Example #8
0
        public async Task Delete_WhenCalled_ShouldWork()
        {
            _mockAdapter.Setup(
                _ => _.Delete(It.IsAny <string>())).Returns(Task.FromResult(HttpStatusCode.NoContent)
                                                            );
            var repository = new SkillsRepository(_mockAdapter.Object, _mockLogger.Object);
            var actual     = await repository.Delete("");

            Assert.IsAssignableFrom <HttpStatusCode>(actual);
            Assert.Contains(
                ((int)HttpStatusCode.NoContent).ToString(), JsonConvert.SerializeObject(actual)
                );
        }
Example #9
0
        public async Task Update_WhenCalled_ShouldWork()
        {
            var expected = "1234567890";
            var skillDto = new SkillDto {
                Id = expected
            };

            _mockAdapter.Setup(_ => _.Update(It.IsAny <SkillDto>())).Returns(Task.FromResult(skillDto));
            var repository = new SkillsRepository(_mockAdapter.Object, _mockLogger.Object);
            var actual     = await repository.Update(skillDto);

            Assert.IsAssignableFrom <SkillDto>(actual);
            Assert.Equal(expected, actual.Id);
        }
Example #10
0
        public IEnumerable <SkillCategoryDto> GetAllSkillsCategories()
        {
            IEnumerable <SkillCategoryDto> results = null;

            try
            {
                var categories = new SkillsRepository(_appDbContext).GetSkillsCategories();
                results = _mapper.Map <IEnumerable <SkillCategory>, IEnumerable <SkillCategoryDto> >(categories);
            }
            catch (Exception e)
            {
                _log.LogError(e, "Error in GetSkillsByCategoryId");
            }
            return(results);
        }
Example #11
0
        public IEnumerable <SkillDto> Get()
        {
            IEnumerable <SkillDto> results = null;

            try
            {
                var allSkills = new SkillsRepository(_appDbContext).GetAll();
                results = _mapper.Map <IEnumerable <Skill>, IEnumerable <SkillDto> >(allSkills);
            }
            catch (Exception e)
            {
                _log.LogError(e, "Error in Get()");
            }
            return(results);
        }
Example #12
0
        public IEnumerable <SkillDto> GetSkillsByCategoryId(int id)
        {
            IEnumerable <SkillDto> results = null;

            try
            {
                var relevantSkills = new SkillsRepository(_appDbContext).GetSkillsByCategoryId(id);
                results = _mapper.Map <IEnumerable <Skill>, IEnumerable <SkillDto> >(relevantSkills);
            }
            catch (Exception e)
            {
                _log.LogError(e, "Error in GetSkillsByCategoryId");
            }
            return(results);
        }
Example #13
0
        private FrontPageViewModel GetFrontPageViewModel(PageViewMode?mode)
        {
            var repo         = new PersonalInfoRepository();
            var personalInfo = repo.GetPersonalInfo();

            var eduRepo    = new EducationRepository();
            var educations = eduRepo.GetEducations();

            var expRepo    = new WorkExperienceRepository();
            var experience = expRepo.GetWorkExperience();

            var skillsRepo = new SkillsRepository();
            var skills     = skillsRepo.GetSkills();

            ViewBag.Mode = mode ?? PageViewMode.View;

            var frontPageViewModel = new FrontPageViewModel()
            {
                EducationBlock = new EducationListViewModel()
                {
                    NewEducation = new EducationViewModel()
                },
                WorkExperienceBlock = new WorkExperienceListViewModel()
                {
                    NewWorkExpirience = new WorkExperienceViewModel()
                },
                SkillCategoryBlock = new SkillsCategoryListViewModel()
                {
                    NewSkillCategory = new SkillsCategoryViewModel(),
                }
            };

            frontPageViewModel.PersonalInfo = new PersonalInfoViewModel(personalInfo);

            frontPageViewModel.EducationBlock.EducationList = educations.Select(x => new EducationViewModel(x)).ToList();
            frontPageViewModel.EducationBlock.NewEducation  = new EducationViewModel();

            frontPageViewModel.WorkExperienceBlock.WorkExperienceList = experience.Select(x => new WorkExperienceViewModel(x)).ToList();
            frontPageViewModel.WorkExperienceBlock.NewWorkExpirience  = new WorkExperienceViewModel();

            frontPageViewModel.SkillCategoryBlock.SkillsCategoryList = skills.Select(x => new SkillsCategoryViewModel(x)).ToList();
            frontPageViewModel.SkillCategoryBlock.NewSkillCategory   = new SkillsCategoryViewModel();

            return(frontPageViewModel);
        }
        public async Task <List <EntityReference> > GetAllReferences(int id)
        {
            List <EntityReference> entityReferences = new List <EntityReference>();

            entityReferences.AddRange(AcademiaRepository.Where(x => x.CompensationMatrixId == id)
                                      .ToList()
                                      .Select(x => new EntityReference()
            {
                Id = entityReferences.Count + 1, Name = x.Name, Code = x.Code, Type = "Academia"
            }));

            entityReferences.AddRange(SkillsRepository.Where(x => x.CompensationMatrixId == id)
                                      .ToList()
                                      .Select(x => new EntityReference()
            {
                Id = entityReferences.Count + 1, Name = x.Name, Code = x.Code, Type = "Skill"
            }));

            entityReferences.AddRange(FunctionsRepository.Where(x => x.CompensationMatrixId == id)
                                      .ToList()
                                      .Select(x => new EntityReference()
            {
                Id = entityReferences.Count + 1, Name = x.Name, Code = x.Code, Type = "Function"
            }));

            entityReferences.AddRange(TasksRepository.Where(x => x.CompensationMatrixId == id)
                                      .ToList()
                                      .Select(x => new EntityReference()
            {
                Id = entityReferences.Count + 1, Name = x.Name, Code = x.Code, Type = "Task"
            }));

            entityReferences.AddRange(JobsRepository.Where(x => x.CompensationMatrixId == id)
                                      .ToList()
                                      .Select(x => new EntityReference()
            {
                Id = entityReferences.Count + 1, Name = x.Name, Code = x.Code, Type = "Job"
            }));

            return(entityReferences);
        }
        public async Task <OS_TaskSkillTemplate_Dto> AddTaskSkillTemplate(OS_TaskSkillTemplate_Dto functionSkillTemplate)
        {
            OS_TaskSkillTemplate toAdd = ObjectMapper.Map <OS_TaskSkillTemplate_Dto, OS_TaskSkillTemplate>(functionSkillTemplate);

            return(ObjectMapper.Map <OS_TaskSkillTemplate, OS_TaskSkillTemplate_Dto>(await SkillsRepository.InsertAsync(toAdd)));
        }
        //public async Task<OS_TaskQualificationTemplate_Dto> AddQualificationTemplate(OS_TaskQualificationTemplate taskQualificationTemplate)
        //{
        //    return ObjectMapper.Map<OS_TaskQualificationTemplate, OS_TaskQualificationTemplate_Dto>(await QualificationsRepository.InsertAsync(taskQualificationTemplate));
        //}
        //public async Task<OS_TaskQualificationTemplate_Dto> AddQualificationTemplate(OS_TaskQualificationTemplate_Dto taskQualificationTemplate)
        //{
        //    OS_TaskQualificationTemplate toAdd = ObjectMapper.Map<OS_TaskQualificationTemplate_Dto, OS_TaskQualificationTemplate>(taskQualificationTemplate);
        //    return ObjectMapper.Map<OS_TaskQualificationTemplate, OS_TaskQualificationTemplate_Dto>(await QualificationsRepository.InsertAsync(toAdd));
        //}

        public async Task <OS_TaskSkillTemplate_Dto> AddTaskSkill(OS_TaskSkillTemplate functionSkillTemplate)
        {
            return(ObjectMapper.Map <OS_TaskSkillTemplate, OS_TaskSkillTemplate_Dto>(await SkillsRepository.InsertAsync(functionSkillTemplate)));
        }
 public SkillsController(SkillsRepository repository)
 {
     _repository = repository;
 }
Example #18
0
 public SkillsController()
 {
     _context    = new KEPT_DBEntities();
     _repository = new SkillsRepository(_context);
 }
Example #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="website.Controllers.SkillsController"/> class.
 /// </summary>
 public SkillsController()
 {
     _skillsRepository = new SkillsRepository();
 }