예제 #1
0
        //Create model from dto
        public static ClockModel CreateModel(VehicleDTO inVehicle)
        {
            ClockModel newModel = new ClockModel()
            {
                //Format in given string
                time = DateTime.Now.ToString("dd/MMM/yyyy HH:mm:ss"),
                //Reverse the current state of the vehicle to clock out.
                clock   = inVehicle.state == "In" ? "Out" : "In",
                vehicle = VehicleModel.CreateModel(inVehicle)
            };

            return(newModel);
        }
예제 #2
0
        public async Task <IActionResult> EditVehicle(string lPlate)
        {
            if (lPlate == null)
            {
                return(RedirectToAction("Index"));
            }

            VehicleDTO dto = await _beService.GetVehicleAsync(lPlate);

            VehicleModel model = VehicleModel.CreateModel(dto);

            return(View("VehicleEdit", model));
        }