示例#1
0
 public async Task <GetCategoryByIdResponse> Handle(GetCategoryByIdRequest request)
 {
     return(new GetCategoryByIdResponse()
     {
         Category = CategoryApiModel.FromCategory(await _context.Categories
                                                  .Include(x => x.Tenant)
                                                  .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId))
     });
 }
示例#2
0
            public async Task <GetCategoriesResponse> Handle(GetCategoriesRequest request)
            {
                var categories = await _context.Categories
                                 .Include(x => x.Tenant)
                                 .Where(x => x.Tenant.UniqueId == request.TenantUniqueId)
                                 .ToListAsync();

                return(new GetCategoriesResponse()
                {
                    Categories = categories.Select(x => CategoryApiModel.FromCategory(x)).ToList()
                });
            }