Exemple #1
0
        public async Task <IActionResult> Get([FromQuery(Name = "search")] string searchString)
        {
            if (string.IsNullOrEmpty(searchString))
            {
                return(Ok(await _skillLogic.GetAsync()));
            }

            var skills = await _skillLogic.SearchAsync(searchString);

            if (skills.Count() == 0)
            {
                return(NoContent());
            }
            else
            {
                return(Ok(skills));
            }
        }
Exemple #2
0
        public async Task <ResponseLogic> AddSkillAsync(int userId, int skillId)
        {
            var user = await _repository.FindAsync(userId);

            var skill = await _skillLogic.GetAsync(skillId);

            if (user.Skills.Contains(skill))
            {
                return(ResponseLogic.SUCCESS);
            }

            if (skill != null)
            {
                user.Skills.Add(skill);
            }

            return(await UpdateAsync(userId, user));
        }