Exemple #1
0
        public void DeleteGroup(DeleteGroupCommand command)
        {
            var now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();

            CascadeDeleteGroup(command.GroupId, command.OrganizationId, now);
            context.SaveChanges();
        }
        /// <inheritdoc />
        public int CreateUserInvitation(CreateUserInvitationCommand command, string inviteGuid)
        {
            var entity = mapper.Map <UserInvitationEntity>(command);

            entity.CreatedAt      = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
            entity.InvitationGuid = inviteGuid;

            context.UserInvitations.Add(entity);
            context.SaveChanges();
            return(entity.UserInvitationEntityId);
        }
Exemple #3
0
        public GetOrganizationUserResult SetOrganizationUserLockedStatus(string externalUserId, bool isLocked)
        {
            var users = GetBaseOrganizationUserEntity()
                        .Where(ou => string.Equals(ou.UserId, externalUserId, StringComparison.OrdinalIgnoreCase))
                        .ToList();


            users.ForEach(ou => ou.IsLocked = isLocked);
            context.UpdateRange(users);
            context.SaveChanges();

            var first = users.First();

            return(this.mapper.Map <GetOrganizationUserResult>(first));
        }
        public void UpdateOrganization(UpdateOrganizationCommand command)
        {
            if (command.OrganizationId != null)
            {
                var id = command.OrganizationId.Value;
                var organizationEntity = context.Organizations.Find(id);

                organizationEntity.UpdatedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                if (command.Name != null)
                {
                    organizationEntity.Name = command.Name;
                }
                if (command.IsActive.HasValue)
                {
                    organizationEntity.IsActive = command.IsActive.Value;
                }

                context.Organizations.Update(organizationEntity);
                context.SaveChanges();
            }
        }