public static List <CarsDetailsDto> GetProductTypes(ProductTypesDto productID)
 {
     try
     {
         DataTable dt;
         wlSQL     objWLSql = new wlSQL();
         objWLSql.AddParameter("@paramType", DbType.Int32, ParameterDirection.Input, 0, 7);
         objWLSql.AddParameter("@ProductTypeId", DbType.String, ParameterDirection.Input, 0, productID.ProductTypeId);
         dt = objWLSql.ExecuteDataSet("emi_carproduct").Tables[0];
         return(Util.ConvertDataTable <CarsDetailsDto>(dt));
     }
     catch (Exception ex)
     {
         throw wlLogging.HandleEx(ex);
     }
 }
        public HttpResponseMessage GetProductTypes([FromBody] ProductTypesDto productTypes)
        {
            try
            {
                ApplicationMessage appmessage  = new ApplicationMessage();
                CarDetailsResponse carResponse = new CarDetailsResponse();
                CarProductDetails  carresults  = new CarProductDetails();

                List <CarsDetailsDto> carlst = new List <CarsDetailsDto>();
                carresults.appCarDetails = CarsRepository.GetProductTypes(productTypes);
                carResponse.results      = carresults;
                //carresults.apiMessage = appmessage.carproductSuccessfully;
                carResponse.status  = true;
                carResponse.message = appmessage.executedSuccessfully;

                List <CarImages>    lstimages   = new List <CarImages>();
                List <CarImagesDto> lstimages2  = new List <CarImagesDto>();
                CarImagesDto        carImagesdd = new CarImagesDto();
                lstimages = CarsRepository.GetAllImages();

                if (carresults.appCarDetails.Count > 0)
                {
                    carresults.apiMessage = appmessage.carproductSuccessfully;
                }
                else
                {
                    carresults.apiMessage = appmessage.carproductFails;
                }


                if (carresults.appCarDetails != null)
                {
                    string imgPath = ConfigurationManager.AppSettings["imgPath"];
                    foreach (var item in carresults.appCarDetails)
                    {
                        CarsDetailsDto carsProduct = new CarsDetailsDto();
                        carsProduct.CarsProductId          = item.CarsProductId;
                        carsProduct.CarsProductName1       = item.CarsProductName1;
                        carsProduct.CarsProductDescription = item.CarsProductDescription;
                        carsProduct.CarsPrice      = item.CarsPrice;
                        carsProduct.CarsColor      = item.CarsColor;
                        carsProduct.CarsKilometers = item.CarsKilometers;
                        carsProduct.CarsDoors      = item.CarsDoors;
                        foreach (var mg in lstimages)
                        {
                            if (mg.SessionId == item.CarsProductId)
                            {
                                carImagesdd.ProductImages = imgPath + mg.CarsImages;
                                lstimages2.Add(carImagesdd);
                            }

                            //carsProduct.CarsImages = imgPath + item.CarsImages;
                        }
                        carsProduct.CarsImagess = lstimages2;
                        carlst.Add(carsProduct);
                    }
                    carresults.appCarDetails = carlst;
                    //carresponse.results = carlst;
                    var response = this.Request.CreateResponse(HttpStatusCode.OK);
                    response.Content = new StringContent(JsonConvert.SerializeObject(carResponse, Formatting.None), Encoding.UTF8, "application/json");
                    return(response);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Not found"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }