public override void Execute(Command command) { var capacity = int.Parse(command.GetParams()[0]); var lot = new Models.ParkingLot(capacity); _parkingLotService.CreateParkingLot(lot, new ParkingStrategy()); Console.WriteLine("Created parking lot"); }
/// <summary> /// Constructs a ParkingLot ViewModel from a ParkingLot Model /// </summary> /// <param name="lot">The ParkingLot Model</param> public ParkingLot(Models.ParkingLot lot) { ID = lot.ID; Name = lot.Name; Annotations = lot.Annotations.Select(a => new Annotation(a)).ToList(); if (lot.Camera != null) { CameraID = lot.Camera.ID; } }
public void CreateParkingLot(Models.ParkingLot parkingLot, ParkingStrategy strategy) { if (_parkingLot != null) { throw new Exception("Parking lot already exists"); } _parkingLot = parkingLot; _parkingStrategy = strategy; for (int i = 1; i <= _parkingLot.Capacity; i++) { _parkingStrategy.AddSlot(i); } }
private Models.ParkingLot BuildParkingLotModel() { var model = new Models.ParkingLot() { TotalMoneyCollected = _parkingLot.GetTotalMoneyCollected() }; _parkingLot.List().ToList().ForEach(v => model.Vehicles.Add(new Models.Vehicle(v))); model.TotalMoneyCollectedByVehicleType[VehicleType.Compact.ToString()] = _parkingLot.GetTotalMoneyCollectedByVehicleType(VehicleType.Compact); model.TotalMoneyCollectedByVehicleType[VehicleType.Electric.ToString()] = _parkingLot.GetTotalMoneyCollectedByVehicleType(VehicleType.Electric); model.TotalMoneyCollectedByVehicleType[VehicleType.Full.ToString()] = _parkingLot.GetTotalMoneyCollectedByVehicleType(VehicleType.Full); model.TotalMoneyCollectedByVehicleType[VehicleType.Motorcycle.ToString()] = _parkingLot.GetTotalMoneyCollectedByVehicleType(VehicleType.Motorcycle); model.TotalMoneyCollectedByVehicleType[VehicleType.Truck.ToString()] = _parkingLot.GetTotalMoneyCollectedByVehicleType(VehicleType.Truck); return(model); }