public async Task <GetProfileByIdResponse> Handle(GetProfileByIdRequest request)
 {
     return(new GetProfileByIdResponse()
     {
         Profile = ProfileApiModel.FromProfile(await _context.Profiles
                                               .Include(x => x.Tenant)
                                               .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId))
     });
 }
예제 #2
0
            public async Task <GetProfilesResponse> Handle(GetProfilesRequest request)
            {
                var profiles = await _context.Profiles
                               .Include(x => x.Tenant)
                               .Where(x => x.Tenant.UniqueId == request.TenantUniqueId)
                               .ToListAsync();

                return(new GetProfilesResponse()
                {
                    Profiles = profiles.Select(x => ProfileApiModel.FromProfile(x)).ToList()
                });
            }
예제 #3
0
        public static TModel FromAccount <TModel>(Account account) where
        TModel : AccountApiModel, new()
        {
            var model = new TModel();

            model.Id = account.Id;

            model.TenantId = account.TenantId;

            model.Firstname = account.Firstname;

            model.Lastname = account.Lastname;

            model.Email = account.Email;

            model.Profiles = account.Profiles.Select(x => ProfileApiModel.FromProfile(x)).ToList();

            return(model);
        }