Ejemplo n.º 1
0
        public async Task <IActionResult> GetAvailableWorkshopsForUser(int userId)
        {
            var user = await _userManager.FindByIdAsync(userId.ToString());

            List <Workshop> result;

            if (await _userManager.IsInRoleAsync(user, "User"))
            {
                result = await _service.GetAvailableWorkshopsForUser(userId, user.DateOfBirth);
            }
            else
            {
                result = await _service.GetAvailableWorkshopsForUser(userId, null);
            }

            return(Ok(result));
        }