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); }
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); }
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; } }