Пример #1
0
        public void Enrich(IHalResponseBuilder halResponseBuilder, ShopAggregate shop)
        {
            halResponseBuilder.AddEmbedded(e => e.AddObject(_responseBuilder.GetShop(shop),
                                                            (l) =>
            {
                l.AddOtherItem("category", new Dtos.Link("/" + Constants.RouteNames.ShopCategories + "/" + shop.CategoryId, shop.ShopCategory.Name)).AddSelf(Constants.RouteNames.Shops + "/" + shop.Id);
                if (shop.ShopFilters != null && shop.ShopFilters.Any())
                {
                    foreach (var filter in shop.ShopFilters)
                    {
                        l.AddOtherItem("filters", new Dtos.Link("/" + Constants.RouteNames.Filers + "/" + filter.Id, filter.Name));
                    }
                }

                if (shop.ProductCategories != null && shop.ProductCategories.Any())
                {
                    foreach (var productCategory in shop.ProductCategories)
                    {
                        l.AddOtherItem("productCategories", new Dtos.Link("/" + Constants.RouteNames.Filers + "/" + productCategory.Id, productCategory.Name));
                    }
                }
            }));
        }