using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using BlueWest.WebApi.EF; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace BlueWest.WebApi.Context.Users; /// /// Users Repository /// public class UserRepository : UserStore { private readonly ApplicationUserDbContext _context; /// /// User repository /// /// /// public UserRepository(ApplicationUserDbContext context, IdentityErrorDescriber describer = null) : base(context, describer) { _context = context; } /// /// Get Application Users /// /// public async Task> GetUsers() { var users = await _context.Users.ToListAsync(); return users; } /// public override Task GetPasswordHashAsync(ApplicationUser user, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled(cancellationToken); } return Task.FromResult(user.PasswordHash); } /// public override Task HasPasswordAsync(ApplicationUser user, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled(cancellationToken); } return Task.FromResult(!string.IsNullOrEmpty(user.PasswordHash)); } }