// // GET: /Assets/Create public ActionResult Create(bool isPrimaryAsset, int parentAssetID) { IntegrationWebSiteMvc.CorporateData.AssetUpdate newAsset = new IntegrationWebSiteMvc.CorporateData.AssetUpdate(); switch (isPrimaryAsset) { case true: { newAsset.AssetType = "SITE"; ViewBag.Customers = _modelContext.Customers; break; } case false: { newAsset.ParentAsset = new BusinessObjects.WorkManagement.ReferenceType(); newAsset.ParentAsset.ID = parentAssetID; break; } } return View(newAsset); }
// // GET: /Assets/Edit/5 public ActionResult Edit(int id, int parentAssetID) { IntegrationWebSiteMvc.CorporateData.AssetUpdate newAsset = new IntegrationWebSiteMvc.CorporateData.AssetUpdate(); bool isPrimaryAsset = false; newAsset = _modelContext.GenerateAssetUpdate(id); isPrimaryAsset = !string.IsNullOrEmpty(newAsset.AssetType) && newAsset.AssetType.ToUpper() == "SITE"; switch (isPrimaryAsset) { case true: { ViewBag.Customers = _modelContext.Customers; ViewBag.LocationXml = newAsset.Location.Serialize(); break; } case false: { if (parentAssetID > 0) { newAsset.ParentAsset = new BusinessObjects.WorkManagement.ReferenceType(); newAsset.ParentAsset.ID = parentAssetID; } break; } } return View("Create", newAsset); }