Beispiel #1
0
        public override async Task Delete(ApplicationUserEntity entity)
        {
            var repositoryOfUserProfile = new RepositoryOfUserProfile(context, serviceOfSearch);
            var userProfile             = repositoryOfUserProfile.Read(a => a.Id == entity.UserProfileId);

            serviceOfSearch.DeleteUser(entity);
            await repositoryOfUserProfile.Delete(userProfile);
        }
Beispiel #2
0
        public override ApplicationUserEntity Create(ApplicationUserEntity entity)
        {
            entity.Created = DateTime.Now;
            var ApplicationUser = base.Create(entity);

            serviceOfSearch.Create <ApplicationUserEntity>(ApplicationUser);
            IRepository <UserProfileEntity> repositoryOfUserProfile = new RepositoryOfUserProfile(context, serviceOfSearch);
            var UserProfile = repositoryOfUserProfile.Read(a => a.Id == ApplicationUser.UserProfileId);

            if (UserProfile == null)
            {
                UserProfile = new UserProfileEntity()
                {
                    ApplicationUserId = ApplicationUser.Id
                };
                UserProfile = repositoryOfUserProfile.Create(UserProfile);
                ApplicationUser.UserProfileId = UserProfile.Id;
            }
            this.Update(ApplicationUser);

            return(ApplicationUser);
        }