public async ValueTask Load(ProfilesContext context, int accountId)
        {
            var profile = await context.Profiles.FirstAsync(p => p.AccountId == accountId);

            Nickname = profile.Nickname;
            Created  = profile.Created;
        }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
        public async ValueTask Update(ProfilesContext context, int accountId)
        {
            var profile = await context.Profiles.FirstAsync(p => p.AccountId == accountId);

            if (Nickname != null)
            {
                profile.Nickname = Nickname;
            }
        }
Esempio n. 4
0
        public async ValueTask Create(ProfilesContext context, int accountId)
        {
            var profile = new Profile
            {
                Nickname  = Nickname,
                AccountId = accountId,
                Created   = DateTime.UtcNow
            };

            await context.Profiles.AddAsync(profile);
        }
Esempio n. 5
0
 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);
        }