public Task SetAsync( AccountFlagType type, Dictionary <string, string> headers = default, CancellationToken ct = default) { return(_factory.PutAsync(_host + "/Account/Flags/v1/Set", null, new { type }, headers, ct)); }
public async Task SetAsync(Guid accountId, AccountFlagType type, CancellationToken ct) { var flag = await _storage.AccountFlags .FirstOrDefaultAsync(x => x.Type == type && x.AccountId == accountId, ct); if (flag != null) { flag.SetDateTime = DateTime.UtcNow; _storage.Update(flag); } else { flag = new AccountFlag { Id = Guid.NewGuid(), AccountId = accountId, Type = type, SetDateTime = DateTime.UtcNow }; await _storage.AddAsync(flag, ct); } await _storage.SaveChangesAsync(ct); }
public Task <bool> IsSetAsync(Guid accountId, AccountFlagType type, CancellationToken ct) { return(_storage.AccountFlags .AsNoTracking() .AnyAsync(x => x.AccountId == accountId && x.Type == type, cancellationToken: ct)); }
public Task Set(AccountFlagType type, CancellationToken ct = default) { return(_accountFlagsService.SetAsync(_userContext.AccountId, type, ct)); }