public async Task <IActionResult> AddVehicleSubmission(VehicleSubmissions submission) { //assign and pass it into AddVehicleSubmission var foundVehicle = _context.VehicleInventory.ToList() .FirstOrDefault(x => x.VinNumber == submission.Vehicle.VinNumber); if (foundVehicle != null) { throw new Exception("Already Submitted that Vehicle"); } var price = Int32.Parse(await _marketPrice.GetAverageVehiclePrice(submission.Vehicle.VinNumber)); submission.VehicleId = _vehicleService.AddVehicle(submission.Vehicle); await _service.AddVehicleSubmission(submission, price); return(Ok(new { message = "Vehicle submission added" })); }
public async Task <IActionResult> GetMarketValue(string vin) { return(Ok(await _marketValueService.GetAverageVehiclePrice(vin))); }