Пример #1
0
        public ActionResult AddProduct(Guid guid, Guid themeImageGuid)
        {
            Theme theme = this._queryDispatcher.Dispatch<Theme, GetThemeByGuidQuery>(new GetThemeByGuidQuery(guid));
            ThemeImage themeImage = theme.Images.First(o => o.Guid == themeImageGuid);
            IList<Guid> productGuids = themeImage.Products.Select(o => o.ProductGuid).ToList();

            var products = this._queryDispatcher.Dispatch<IList<Product>, GetProductsByGuidsQuery>(new GetProductsByGuidsQuery(productGuids));

            AddProductToThemeImageViewModel viewModel = new AddProductToThemeImageViewModel(themeImage, products);

            return this.PartialView("AddProduct", viewModel);
        }
Пример #2
0
        public ActionResult SaveProduct(Guid guid, AddProductToThemeImageViewModel viewModel, Member member)
        {
            if (this.ModelState.IsValid)
            {
                this._commandDispatcher.Dispatch(new AddProductToThemeCommand(guid, viewModel.ThemeImageGuid, viewModel.ThemeProductGuid, viewModel.ProductGuid.Value, viewModel.Qty.Value, viewModel.X.Value, viewModel.Y.Value, member));
            }

            return this.RedirectToRoute(Routes.Themes.Products);
        }