Esempio n. 1
0
        public IActionResult GetVehicle(int vehicleNumber)
        {
            Vehicles vehicle = manager.GetVehicle(vehicleNumber);

            if (vehicle != null)
            {
                List <Vehicles> list = new List <Vehicles>();
                list.Add(vehicle);
                return(Ok(Extended(list)[0]));
            }
            return(Ok(null));
        }
Esempio n. 2
0
 public static void ExecuteCommand(int UserCommand, ref VehicleManager vehicleManager, ref List <Vehicle> vehicles, ref long TotalVisitor)
 {
     if (UserCommand == (int)Commandtype.Add)
     {
         vehicleManager.VehicleTypeSelectInstruction();
         Int32   vehicleType   = Convert.ToInt32(Console.ReadLine());
         Vehicle vehicle       = vehicleManager.GetVehicle((VehicleType)vehicleType);
         long    VehicleNextId = vehicleManager.GetNextId(vehicles);
         vehicleManager.Add(vehicleManager.SetVechileData(vehicle, VehicleNextId, ref TotalVisitor), ref vehicles);
     }
     else if (UserCommand == (int)Commandtype.Remove)
     {
         Console.WriteLine("Use Vehicle Id for Remove Vehicle");
         vehicleManager.ShowVechileList(vehicles);
         Console.WriteLine("Please Press Vehile Id");
         object VehicleId = Convert.ToInt32(Console.ReadLine());
         vehicleManager.Remove(VehicleId, ref vehicles);
         Console.WriteLine("Remove Success VehicleId=" + VehicleId);
     }
     else if (UserCommand == (int)Commandtype.ShowVehicleList)
     {
         vehicleManager.ShowVechileList(vehicles);
     }
     else if (UserCommand == (int)Commandtype.ShowVehicleListWithTotalVisitor)
     {
         Console.WriteLine("Total Visitor Is:" + TotalVisitor);
         vehicleManager.ShowVechileList(vehicles);
     }
     else if (UserCommand == (int)Commandtype.ClearCommandLine)
     {
         Console.Clear();
     }
     else if (UserCommand == (int)Commandtype.CommandLineHelp)
     {
         vehicleManager.CommandLineHelpInstruction();
     }
     else
     {
         Console.WriteLine("Please Press Command Between 1 and 5");
     }
 }
Esempio n. 3
0
        public IActionResult GetVehicleById(int vehicleId)
        {
            var v = _vehicleManager.GetVehicle(vehicleId);

            return(Ok(v));
        }