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

            Nickname = profile.Nickname;
            Created  = profile.Created;
        }
예제 #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();
 }
예제 #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;
            }
        }
예제 #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);
        }
예제 #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);
        }