Пример #1
0
        public ActionResult Index(int productId, int?rowId = null)
        {
            GenerateFormQueryResult        result       = Query.For <GenerateFormQueryResult>().ById(productId);
            GetProductTableByIdQueryResult productTable = Query.For <GetProductTableByIdQueryResult>().ById(productId);

            if (result == null)
            {
                // TODO: Redirect to not found page.
                return(null);
            }

            RowIndexViewModel vm = new RowIndexViewModel
            {
                Table = productTable.Table
            };

            if (rowId.HasValue)
            {
                FindRowByIdQueryResult row = Query.For <FindRowByIdQueryResult>().ById(rowId.Value);

                if (row != null)
                {
                    vm.Form           = ToEditViewModel(result, row.Row);
                    vm.IsEdittingMode = true;
                    ViewBag.ProductId = productId;
                }
            }

            if (vm.Form == null)
            {
                vm.Form = ToViewModel(result);
            }

            return(View(vm));
        }
Пример #2
0
        // GET: ProductInfo
        public ActionResult Index(int id)
        {
            GetProductTableByIdQueryResult productTable = Query.For <GetProductTableByIdQueryResult>().ById(id);

            ProductInfoIndexViewModel vm = new ProductInfoIndexViewModel
            {
                Table = productTable.Table
            };

            return(View(vm));
        }