public void CreateSkillTest() { Skill skill = new Skill { Skill_Id = 0, Skill_Name = "TestSkill", Associate_Skills = null }; var sk = skillsService.CreateSkill(skill); Assert.NotNull(sk); Assert.Greater(sk.Skill_Id, 0); }
public HttpResponseMessage AddSkill([FromBody] SkillModel skill) { SkillModel result = new SkillModel(); try { var alreadyExists = _skillsService.GetSkillByName(skill.Skill_Name); if (alreadyExists == null) { var input = Helper.CastObject <Skill>(skill); var res = _skillsService.CreateSkill(input); result = Helper.CastObject <SkillModel>(res); } } catch (Exception ex) { _logManager.WriteLog(ex); } return(ToJson(result)); }
public IActionResult PostSkill([FromBody] Skill skill) { _skillsService.CreateSkill(skill); return(CreatedAtAction("GetSkill", new { id = skill.SkillID }, skill)); }