Example #1
0
        public async Task <IdentityResult> DeleteAsync(Role role, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            if (role == null)
            {
                throw new ArgumentNullException(nameof(role));
            }
            _dbcontext.Remove(role);
            await _dbcontext.SaveChangesAsync(cancellationToken);

            return(await Task.FromResult(IdentityResult.Success));
        }
        public async Task <IdentityResult> DeleteAsync(User user, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            if (user == null)
            {
                throw new ArgumentNullException();
            }
            _dbcontext.Remove(user);

            var returnValue = await _dbcontext.SaveChangesAsync(cancellationToken);

            return(await Task.FromResult(returnValue == 1?IdentityResult.Success : IdentityResult.Failed()));
        }