Exemplo n.º 1
0
        public IActionResult GetSkills(string username, string expertId = null)
        {
            try
            {
                var user   = _userService.GetByUserName(username);
                var skills = _skillService.GetUserSkills(user.Id);

                var skillsDto = skills.Select(skill => new SkillDto
                {
                    Id              = skill.Id,
                    Name            = skill.Name,
                    Description     = skill.Description,
                    AverageEvaluate = _evaluateService.GetAverageEvaluate(skill.Id, user.Id),
                    ExpertEvaluate  = expertId != null ? _evaluateService.GetSkillValueByExpert(user.Id, skill.Id, expertId) : 0
                });

                return(Ok(skillsDto));
            }
            catch (AppException e)
            {
                return(BadRequest(new { message = e.Message }));
            }
        }