public async Task <IUser> CreateUserAsync(string username, bool isAuthorized, CancellationToken cancellationToken = default) { var user = new PostgresUser { Id = this.IdGenerator.Generate(), Username = username, AvatarUrl = null, IsAuthorized = isAuthorized }; try { await this.Database.Users.AddAsync(user, cancellationToken); await this.Database.SaveChangesAsync(cancellationToken); return(user); } catch { return(null); } }
public PostgresFactory(PostgresDbContext context) { _users = new PostgresUser(context); }