public ActionResult DeleteWorkstations(Workstation workstation) { RealEstate realEstate = virames <RealEstate> .Initialize(new RealEstate()).Where(x => x.ID == workstation.ID) .Take(); if (realEstate != null) { realEstate.Delete(); } workstation.Delete(); return(RedirectToAction("Workstations")); }
public ActionResult DeleteAsset(Asset asset) { RealEstate realEstate = virames <RealEstate> .Initialize(new RealEstate()).Where(x => x.AssetID == asset.ID) .Take(); if (realEstate != null) { realEstate.Delete(); } Workstation workstation = virames <Workstation> .Initialize(new Workstation()).Where(x => x.AssetID == asset.ID) .Take(); if (workstation != null) { workstation.Delete(); } Equipment equipment = virames <Equipment> .Initialize(new Equipment()).Where(x => x.AssetID == asset.ID) .Take(); if (equipment != null) { equipment.Delete(); } Vehicle vehicle = virames <Vehicle> .Initialize(new Vehicle()).Where(x => x.AssetID == asset.ID) .Take(); if (vehicle != null) { vehicle.Delete(); } asset.Delete(); return(RedirectToAction("Asset")); }