Exemplo n.º 1
0
        public async Task <int> SaveVehicle(VehicleViewModel vehicle, int garageId)
        {
            var vehicleModel = vehicle.Adapt <VehicleModel>();

            vehicleModel.VehicleProgram = await GetProgramVehicleList(vehicle);

            if (vehicle.Id == 0)
            {
                return(await _vehicleFactory.CreateVehicle(vehicleModel, garageId));
            }
            else
            {
                return(await _vehicleFactory.UpdateVehicle(vehicleModel, garageId));
            }
        }