Пример #1
0
        public async Task <IActionResult> AddUserToRol([FromQuery] string userEmail, [FromQuery] string rol)
        {
            try
            {
                _log.LogInformation("Trying to Add a user to rol");

                var user = await _authService.GetUserByEmail(userEmail);

                if (!user.Success || user.Value is null)
                {
                    return(NotFound());
                }

                var result = await _authService.AddUserToRole(user.Value, rol);

                if (result.Success)
                {
                    return(Accepted());
                }

                return(NotFound());
            }
            catch (Exception e)
            {
                _log.LogError(e, $"Update user");
                return(StatusCode(500));
            }
        }