예제 #1
0
        public static CandidateSkillViewModel MapDbModelToViewModel(Database.CandidateSkill dbModel)
        {
            var viewModel = new CandidateSkillViewModel();

            viewModel.CandidateId = dbModel.CandidateId;
            viewModel.SkillId     = dbModel.SkillId;
            viewModel.SkillLevel  = dbModel.SkillLevel;
            return(viewModel);
        }
예제 #2
0
        public static Database.CandidateSkill MapInsertModelToDbModel(CandidateSkillViewModel model, Database.CandidateSkill newDomainModel = null)
        {
            if (newDomainModel == null)
            {
                newDomainModel = new Database.CandidateSkill();
            }

            newDomainModel.CandidateId = model.CandidateId;
            newDomainModel.SkillId     = model.SkillId;
            newDomainModel.SkillLevel  = model.SkillLevel;
            return(newDomainModel);
        }
예제 #3
0
        public async Task <IActionResult> AddSkill([FromBody] CandidateSkillViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest());
                }

                await _candidateManager.AddSkill(
                    new CandidateSkill
                {
                    CandidateId = model.CandidateId,
                    SkillId     = model.SkillId
                });

                return(Ok());
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }