Ejemplo n.º 1
0
        public virtual async Task <IActionResult> ProductsAsync(AbcPromoProductSearchModel searchModel)
        {
            var products = await _abcPromoService.GetProductsByPromoIdAsync(searchModel.AbcPromoId);

            var productsPaged = products.ToPagedList(searchModel);

            var model = await new AbcPromoProductListModel().PrepareToGridAsync(searchModel, productsPaged, () =>
            {
                return(products.SelectAwait(async product =>
                {
                    var productAbcDescription =
                        await _productAbcDescriptionService.GetProductAbcDescriptionByProductIdAsync(product.Id);
                    var abcItemNumber = productAbcDescription?.AbcItemNumber;

                    var abcPromoProductModel = new AbcPromoProductModel()
                    {
                        AbcItemNumber = abcItemNumber,
                        Name = product.Name,
                        Published = product.Published
                    };

                    return abcPromoProductModel;
                }));
            });

            return(Json(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Products(int abcPromoId)
        {
            var abcPromo = await _abcPromoService.GetPromoByIdAsync(abcPromoId);

            var model = new AbcPromoProductSearchModel()
            {
                AbcPromoId   = abcPromo.Id,
                AbcPromoName = abcPromo.Name
            };

            return(View(
                       "~/Plugins/Misc.AbcCore/Areas/Admin/Views/AbcPromo/Products.cshtml",
                       model
                       ));
        }