Esempio n. 1
0
        public async Task <IActionResult> Post([FromBody] SkillCreateDTO skill)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var success = await _skillLogic.CreateAsync(skill);

            if (success == ResponseLogic.SUCCESS)
            {
                var createdSkill = await _skillLogic.FindExactAsync(skill.Name);

                return(CreatedAtAction(nameof(Get), new { createdSkill.Id }, createdSkill.Id));
            }
            else
            {
                return(StatusCode(500));
            }
        }