public ActionResult CheckIn(VehicleCtx ctx) { var car = new CarVehicle(ctx.Owner); car.RegNr = ctx.RegNr; garage.Add(car); TempData["vehicle"] = car; return RedirectToAction("CheckinOK"); }
public Vehicle Fabricate(string Type, List<string> cmdline) { if (cmdline.Count == 0) throw new ArgumentException("Missing owner"); string owner = cmdline[0]; cmdline.RemoveAt(0); Vehicle v; switch (Type) { case "car": v = new CarVehicle(owner); break; case "bus": v = new BusVehicle(owner); break; case "boat": v = new BoatVehicle(owner); break; case "mc": v = new McVehicle(owner); break; case "plane": v = new PlaneVehicle(owner); break; default: throw new ArgumentException("Illegal vehicle type"); } return v.Init(cmdline); }