public ActionResult CreatePort(int assetid) { int cid = dbAsset.Read(assetid).Customer.Id; var model = new CreatePortModel() { assetreturnid = assetid, Assets = dbAsset.ReadAllWithFk(cid), customerId = cid, Port = new Port() { SwitchId = assetid } }; return(View(model)); }
public ActionResult CreatePort(Port port, int assetreturnid, int customerid) { if (ModelState.IsValid) { dbports.Create(port); return(RedirectToAction("AssetDetails", "Customers", new { id = assetreturnid, customerId = customerid })); } int cid = dbAsset.Read(assetreturnid).Customer.Id; var model = new CreatePortModel() { assetreturnid = assetreturnid, Assets = dbAsset.ReadAllWithFk(cid), customerId = cid }; return(View(model)); }
public ActionResult EditPort(int id, int assetid) { Port p = dbports.Read(id); int cid = p.Switch.CustomerId; if (p.SwitchId == 0) { p.SwitchId = p.Switch.Id; } var model = new CreatePortModel() { Port = p, assetreturnid = assetid, customerId = cid, }; return(View(model)); }