Esempio n. 1
0
        public RoleDto[] GetUserRoles(string userId)
        {
            List <IdentityRole> roles;

            try
            {
                roles = _userBusinessLogic.GetUserRoles(userId);
            }
            catch (ArgumentException ex)
            {
                this.Log.Error(LogHelper.GetMethodInfoErrorMessage(MethodBase.GetCurrentMethod(), userId), ex);

                var fault = new EntityNotFoundFault
                {
                    Message    = "User not found",
                    EntityName = typeof(ApplicationUser).Name
                };

                throw new FaultException <EntityNotFoundFault>(fault);
            }

            RoleDto[] rolesDto = Mapper.Map <RoleDto[]>(roles);

            return(rolesDto);
        }