Exemple #1
0
 public Task DeleteAsync(User user)
 {
     ThrowIfDisposed();
     if (user == null)
     {
         throw new ArgumentNullException("user");
     }
     _entities.Delete(user);
     //await SaveChanges().ConfigureAwait(false);
     return(Task.FromResult(0));
 }
Exemple #2
0
        public async Task Handle(DeleteCustomerCommand command, CancellationToken cancellationToken)
        {
            var theCustomer = await _db.Get <Customer>()
                              .SingleOrDefaultAsync(c => c.Id == command.Id, cancellationToken)
                              .ConfigureAwait(false);

            if (theCustomer != null)
            {
                _db.Delete(theCustomer);
            }
        }
        public async Task Handle(DeletePersonCommand command, CancellationToken cancellationToken)
        {
            var person = await _db.Get <Person>().SingleOrDefaultAsync(p => p.Name == command.PersonName, cancellationToken).ConfigureAwait(false);

            if (person == null)
            {
                return;
            }

            _db.Delete(person);
        }
        public async Task Handle(DeleteAddressCommand command, CancellationToken cancellationToken)
        {
            var theAddress = await _db.Get <Address>()
                             .SingleOrDefaultAsync(a => a.Id == command.Id, cancellationToken)
                             .ConfigureAwait(false);

            if (theAddress != null)
            {
                _db.Delete(theAddress);
            }
        }
        public async Task Handle(DeleteRemoteMembership command)
        {
            var userId           = command.Principal.Identity.GetUserId <int>();
            var userLoginInfo    = new UserLoginInfo(command.LoginProvider, command.ProviderKey);
            var remoteMembership = await _entities.Get <RemoteMembership>()
                                   .EagerLoad(new Expression <Func <RemoteMembership, object> >[] { x => x.User, })
                                   .ByUserIdAndLoginInfoAsync(userId, userLoginInfo);

            if (remoteMembership == null)
            {
                return;
            }

            _entities.Delete(remoteMembership);
            await _entities.SaveChangesAsync();
        }
Exemple #6
0
        public async Task Handle(DeleteEmailAddress command)
        {
            // load up the entity
            var entity = await _entities.GetAsync <EmailAddress>(command.EmailAddressId);

            // delete if it is verified
            if (entity.IsVerified)
            {
                _entities.Delete(entity);
            }

            // when it is unverified, just detach from user
            else
            {
                entity.UserId = null;
            }

            await _entities.SaveChangesAsync();
        }
 public void DeleteAlbum(Album album)
 {
     _writeEntities.Delete(album);
 }