Ejemplo n.º 1
0
        public async Task AddNewSkillAsync_SkillResourceAsParam_CreatedSkillResourceReturned()
        {
            var newSkill = new SkillResource()
            {
                Name = "New Skill"
            };


            var addedSkill = await _service.AddSkillAsync(newSkill);

            Assert.AreEqual(newSkill.Name, addedSkill.Name);
            Assert.IsNotNull(addedSkill.Id);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddSkillAsync([FromBody] SkillResource skillResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var createdSkill = await _skillService.AddSkillAsync(skillResource);

            if (createdSkill == null)
            {
                return(BadRequest());
            }
            return(Ok(createdSkill));
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> AddSkill(AddSkillViewModel model)
        {
            if (model == null)
            {
                model = new AddSkillViewModel();
                Validate(model);
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var skill = await _skillService.AddSkillAsync(model, CancellationToken.None);

            return(Ok(skill));
        }
        public async Task <ActionResult <Skill> > PublishSkillAsync([FromBody] AddSkillDto skill)
        {
            var result = await _skillService.AddSkillAsync(skill);

            return(Created("", result));
        }