示例#1
0
        public async Task <IActionResult> PutSkill(int id, PublicApi.v1.DTO.Skill skill)
        {
            if (id != skill.Id)
            {
                return(BadRequest());
            }

            _bll.Skills.Update(PublicApi.v1.Mappers.SkillMapper.MapFromExternal(skill));
            await _bll.SaveChangesAsync();

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <PublicApi.v1.DTO.Skill> > PostSkill(PublicApi.v1.DTO.Skill skill)
        {
            _bll.Skills.Add(PublicApi.v1.Mappers.SkillMapper.MapFromExternal(skill));
            await _bll.SaveChangesAsync();

            return(CreatedAtAction(
                       nameof(GetSkill),
                       new
            {
                version = HttpContext.GetRequestedApiVersion().ToString(),
                id = skill.Id
            }, skill));
        }