public async Task <Shop> GetAsync(Guid id) { var query = new ShopsQuery { FilterIds = id.Collect() }; var shop = (await _queryInvoker.Execute <ShopsQuery, Shop>(query)).SingleOrDefault(); if (shop == null) { return(null); } //ToDo:2 limit depth or use lazy loading shop.ShopCategory.Shops = null; shop.Manager.Shop = null; return(shop); }
public async Task <IEnumerable <Shop> > GetAsync([FromQuery] string nameLike, [FromQuery] Guid?categoryExact, int?take, int?skip, string orderBy, string orderMode) //ToDo:4 optionally include archived? { var query = new ShopsQuery { Take = take, Skip = skip, OrderBy = orderBy, OrderMode = orderMode, FilterNameLike = nameLike, FilterShopCategoryExact = categoryExact, }; //ToDo:2 query.AsLazy(); ?? var shops = await _queryInvoker.Execute <ShopsQuery, Shop>(query); foreach (var shop in shops) { shop.ShopCategory.Shops = null; shop.Manager.Shop = null; } return(shops); }
public ShopController(ShopsQuery shopsQueries, ILogger <ShopController> logger) { _shopsQueries = shopsQueries; _logger = logger; }