public async ValueTask Load(ProfilesContext context, int accountId) { var profile = await context.Profiles.FirstAsync(p => p.AccountId == accountId); Nickname = profile.Nickname; Created = profile.Created; }
public async ValueTask Load(ProfilesContext context, int offset, int limit) { Profiles = await context.Profiles .OrderByDescending(p => p.Created) .Skip(offset) .Take(limit) .Select(p => new AdminReadProfileItemResponse(p)) .ToListAsync(); }
public async ValueTask Update(ProfilesContext context, int accountId) { var profile = await context.Profiles.FirstAsync(p => p.AccountId == accountId); if (Nickname != null) { profile.Nickname = Nickname; } }
public async ValueTask Create(ProfilesContext context, int accountId) { var profile = new Profile { Nickname = Nickname, AccountId = accountId, Created = DateTime.UtcNow }; await context.Profiles.AddAsync(profile); }
public ProfilesController(ProfilesContext context) { this.context = context; }
public async ValueTask ReadById(ProfilesContext context, int accountId) { var profile = await context.Profiles.FirstAsync(p => p.AccountId == accountId); Nickname = profile.Nickname; }
public async ValueTask Delete(ProfilesContext context, int accountId) { var profile = await context.Profiles.FirstAsync(p => p.AccountId == accountId); context.Profiles.Remove(profile); }
public async ValueTask Delete(ProfilesContext context) { var profile = await context.Profiles.FirstAsync(p => p.Id == ProfileId); context.Profiles.Remove(profile); }