public AddCarDetailResponse AddCarDetail(AddCarDetailRequest request)
        {
            var response = new AddCarDetailResponse
            {
                Errors = new List <string>()
            };

            var car = _carRepository.GetById(request.CarId);

            if (car == null)
            {
                response.Errors.Add("Car does not exist");
                response.Success = false;
                return(response);
            }

            if (Convert.ToDateTime(request.Itp) > DateTime.Today &&
                Convert.ToDateTime(request.RoadTax) > DateTime.Today)
            {
                response.Errors.Add("Dates invalid");
                response.Success = false;
                return(response);
            }

            _repository.Add(new CarDetail
            {
                CarId          = request.CarId,
                InsuranceValue = request.InsuranceValue,
                Itp            = request.Itp,
                OilChange      = request.OilChange,
                RoadTax        = request.RoadTax,
                RoadTaxValue   = request.RoadTaxValue,
                TaxValue       = request.TaxValue,
                WinterTires    = request.WinterTires,
                Price          = Convert.ToInt32(_carPriceRepository.GetCarPrice(new ModelInput
                {
                    Make     = car.Make,
                    Model    = car.Model,
                    Cc       = float.Parse(car.Cc),
                    Fuel     = car.Fuel,
                    Odometer = float.Parse(car.Odometer),
                    Power    = float.Parse(car.Power),
                    Year     = float.Parse(car.ModelYear)
                }))
            });

            response.Success = true;
            return(response);
        }
 public JsonResult AddCarDetail([FromBody] AddCarDetailRequest request)
 {
     return(Json(_carDetailService.AddCarDetail(request)));
 }