Пример #1
0
        public DataWrapper GetCompareCarsDataByTrimIdList(string trimIdList)
        {
            try
            {
                if (trimIdList.Length < 1)
                {
                    return(DataWrapper());
                }

                var compareTrimData = VehicleSpecService.GetCompareCarsByTrimIdListAsync(trimIdList).Result;
                if (compareTrimData != null)
                {
                    //var queryResults = compareTrimData;

                    var response = compareTrimData.Select(t => new CompareTrim
                    {
                        Id                = t.Id,
                        CategoryId        = t.CategoryId,
                        Name              = t.Name,
                        SeoName           = t.SeoName,
                        Make              = t.Make,
                        MakeSeoName       = t.MakeSeoName,
                        SuperModel        = t.SuperModel,
                        SuperModelSeoName = t.SuperModelSeoName,
                        Year              = t.Year,
                        Model             = t.Model,
                        IsNew             = t.IsNew,
                        Msrp              = String.Format("${0:0,0}", Convert.ToDouble(t.Msrp)),
                        Invoice           = String.Format("${0:0,0}", Convert.ToDouble(t.Invoice)),
                        CityMpg           = t.CityMpg,
                        HighwayMpg        = t.HighwayMpg,
                        EngineType        = t.EngineType,
                        EngineSize        = t.EngineSize,
                        HorsePower        = t.HorsePower,
                        Specifications    = t.Specifications,
                        Images            = ImageMetaService.GetImagesByTrimIdAsync(t.Id).Result
                                            .Select(im => new Image
                        {
                            Small  = String.Format("{0}_320x.png", im.UrlPrefix),
                            Medium = String.Format("{0}_640x.png", im.UrlPrefix),
                            Large  = String.Format("{0}_1024x.png", im.UrlPrefix)
                        })
                    });

                    return(DataWrapper(response));
                }

                return(DataWrapper());
            }
            catch (Exception)
            {
                //if service returns no filter data...
                return(DataWrapper());
            }
        }
Пример #2
0
        public DataWrapper GetViewedRecentlyByTrimIdList(string trimIdList)
        {
            try
            {
                if (trimIdList.Length < 1)
                {
                    return(DataWrapper());
                }

                var compareTrimData = VehicleSpecService.GetCompareCarsByTrimIdListAsync(trimIdList).Result;
                if (compareTrimData != null)
                {
                    //var queryResults = compareTrimData;

                    var response = compareTrimData.Select(t => new ViewedRecentlyTrim
                    {
                        Id                = t.Id,
                        Name              = t.Name,
                        SeoName           = t.SeoName,
                        Make              = t.Make,
                        MakeSeoName       = t.MakeSeoName,
                        SuperModel        = t.SuperModel,
                        SuperModelSeoName = t.SuperModelSeoName,
                        Year              = t.Year,
                        Model             = t.Model,
                        IsNew             = t.IsNew,
                        Images            = ImageMetaService.GetImagesByTrimIdAsync(t.Id).Result
                                            .Select(im => new Image
                        {
                            Small  = String.Format("{0}_320x.png", im.UrlPrefix),
                            Medium = String.Format("{0}_640x.png", im.UrlPrefix),
                            Large  = String.Format("{0}_1024x.png", im.UrlPrefix)
                        })
                    });

                    return(DataWrapper(response));
                }

                return(DataWrapper());
            }
            catch (Exception)
            {
                //if service returns no filter data...
                return(DataWrapper());
            }
        }