コード例 #1
0
        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;
        }
コード例 #7
0
        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);
        }