コード例 #1
0
 public ActionResult Display(InventoryProductListViewModel input)
 {
     var inventoryProduct = _repository.Find<InventoryProduct>(input.EntityId);
     if (inventoryProduct.Product.InstantiatingType == "Chemical")
     {
         var model = new InventoryChemicalViewModel {InventoryChemical = inventoryProduct};
         return PartialView("InventoryChemicalView", model);
     }
     if (inventoryProduct.Product.InstantiatingType == "Fertilizer")
     {
         var model = new InventoryFertilizerViewModel { InventoryFertilizer = inventoryProduct };
         return PartialView("InventoryFertilizerView", model);
     }
     if (inventoryProduct.Product.InstantiatingType == "Material")
     {
         var model = new InventoryMaterialViewModel { InventoryMaterial = inventoryProduct };
         return PartialView("InventoryMaterialView", model);
     }
     if (inventoryProduct.Product.InstantiatingType == "Seed")
     {
         var model = new InventorySeedViewModel { InventorySeed = inventoryProduct };
         return PartialView("InventorySeedView", model);
     }
     return null;
 }
コード例 #2
0
        public ActionResult Display(InventoryProductListViewModel input)
        {
            var inventoryProduct = _repository.Find <InventoryProduct>(input.EntityId);

            if (inventoryProduct.Product.InstantiatingType == "Chemical")
            {
                var model = new InventoryChemicalViewModel {
                    InventoryChemical = inventoryProduct
                };
                return(PartialView("InventoryChemicalView", model));
            }
            if (inventoryProduct.Product.InstantiatingType == "Fertilizer")
            {
                var model = new InventoryFertilizerViewModel {
                    InventoryFertilizer = inventoryProduct
                };
                return(PartialView("InventoryFertilizerView", model));
            }
            if (inventoryProduct.Product.InstantiatingType == "Material")
            {
                var model = new InventoryMaterialViewModel {
                    InventoryMaterial = inventoryProduct
                };
                return(PartialView("InventoryMaterialView", model));
            }
            if (inventoryProduct.Product.InstantiatingType == "Seed")
            {
                var model = new InventorySeedViewModel {
                    InventorySeed = inventoryProduct
                };
                return(PartialView("InventorySeedView", model));
            }
            return(null);
        }