Exemple #1
0
        public CoreBikeInformation GetBikInfo(int?id)
        {
            CoreBikeInformation     BikeResult   = new CoreBikeInformation();
            List <CoreImagedetails> imagedetails = new List <CoreImagedetails>();

            using (var db = new ObickeEntities())
            {
                var Bikeinfo = db.stpGetBikedetailsInfo(id).ToList();

                if (Bikeinfo != null && Bikeinfo.Count > 0)
                {
                    var BikeInformation = Bikeinfo.FirstOrDefault();

                    BikeResult = new CoreBikeInformation()
                    {
                        BikeId               = BikeInformation.BikeId,
                        BikeBrand            = BikeInformation.BikeBrand,
                        BikeDescription      = BikeInformation.BikeDescription,
                        BikeKmDriven         = BikeInformation.BikeKmDriven,
                        BikeModel            = Convert.ToString(BikeInformation.BikeModel),
                        BikeRegistrationYear = BikeInformation.BikeRegistrationYear,
                        BikePrice            = BikeInformation.BikePrice
                    };

                    foreach (var item in Bikeinfo)
                    {
                        CoreImagedetails imgRes = new CoreImagedetails()
                        {
                            Bikeid    = BikeInformation.BikeId,
                            Imagepath = baseUrl + item.ImgPath.Remove(0, 1)
                        };
                        imagedetails.Add(imgRes);
                    }
                    BikeResult.Imagepath = imagedetails;
                }
            }
            return(BikeResult);
        }