Beispiel #1
0
        public async Task AddUsersToGroup()
        {
            var group   = fillTestDbHelper.Groups.FirstOrDefault();
            var contact = await contactsService.CreateOrEditContactAsync(new ContactDto
            {
                ContactUserId = -1,
                UserId        = group.UserId
            });

            await groupsService.AddUsersToGroupAsync(new List <long> {
                contact.ContactUserId
            }, group.GroupId, group.UserId);
        }
Beispiel #2
0
        public async Task <Response> CreateResponseAsync()
        {
            try
            {
                await groupsService.AddUsersToGroupAsync(request.UsersId, request.GroupId, clientConnection.UserId.GetValueOrDefault()).ConfigureAwait(false);

                return(new ResultResponse(request.RequestId));
            }
            catch (ObjectDoesNotExistsException ex)
            {
                Logger.WriteLog(ex);
                return(new ResultResponse(request.RequestId, "Group or user not found.", ObjectsLibrary.Enums.ErrorCode.ObjectDoesNotExists));
            }
            catch (InvalidOperationException ex)
            {
                Logger.WriteLog(ex);
                return(new ResultResponse(request.RequestId, ex.Message, ObjectsLibrary.Enums.ErrorCode.AddUserProblem));
            }
        }