Example #1
0
        private async Task <bool> CheckUserExistence(List <Guid> usersIds)
        {
            if (!usersIds.Any())
            {
                return(false);
            }

            try
            {
                Response <IOperationResult <ICheckUsersExistence> > response =
                    await _rcCheckUsersExistence.GetResponse <IOperationResult <ICheckUsersExistence> >(
                        ICheckUsersExistence.CreateObj(usersIds));

                if (response.Message.IsSuccess)
                {
                    return(usersIds.Count == response.Message.Body.UserIds.Count);
                }

                _logger.LogWarning(
                    "Error while checkingexisting users withs this ids: {UsersIds}.\nErrors: {Errors}",
                    string.Join(", ", usersIds),
                    string.Join('\n', response.Message.Errors));
            }
            catch (Exception exc)
            {
                _logger.LogError(
                    exc,
                    "Cannot check existing users withs this ids {UsersIds}",
                    string.Join(", ", usersIds));
            }

            return(false);
        }
        private async Task <bool> CheckUserExistence(List <Guid> authorsIds)
        {
            if (!authorsIds.Any())
            {
                return(false);
            }

            try
            {
                Response <IOperationResult <ICheckUsersExistence> > response =
                    await _rcCheckUsersExistence.GetResponse <IOperationResult <ICheckUsersExistence> >(
                        ICheckUsersExistence.CreateObj(authorsIds));

                if (response.Message.IsSuccess)
                {
                    return(authorsIds.Count == response.Message.Body.UserIds.Count);
                }

                _logger.LogWarning("Can not find author Ids: {authorsIds}: " +
                                   $"{Environment.NewLine}{string.Join('\n', response.Message.Errors)}");
            }
            catch (Exception exc)
            {
                _logger.LogError(exc, "Cannot check existing authors withs this ids {authorsIds}");
            }

            return(false);
        }