示例#1
0
        public DataWrapper GetFeaturesByTrimByFeatureType([FromBody] string jsonString)
        {
            Dto.Query query;
            try { query = JsonConvert.DeserializeObject <Dto.Query>(jsonString); }
            catch { throw new HttpResponseException(HttpStatusCode.NotFound); }

            var drives = EvaluationService.GetFeaturesByTrimByFeatureType(query.Trim, FeatureType.Drives)
                         .Select(x => new Dto.Drives
            {
                Key       = x.Key,
                Value     = x.Value,
                PreSelect = x.PreSelect
            }).ToList();
            var engines = EvaluationService.GetFeaturesByTrimByFeatureType(query.Trim, FeatureType.Engines)
                          .Select(x => new Dto.Drives
            {
                Key       = x.Key,
                Value     = x.Value,
                PreSelect = x.PreSelect
            }).ToList();
            var transmissions = EvaluationService.GetFeaturesByTrimByFeatureType(query.Trim, FeatureType.Transmissions)
                                .Select(x => new Dto.Transmissions()
            {
                Key       = x.Key,
                Value     = x.Value,
                PreSelect = x.PreSelect
            }).ToList();
            var vehicleoptions = EvaluationService.GetFeaturesByTrimByFeatureType(query.Trim, FeatureType.Options)
                                 .Select(x => new Dto.Options()
            {
                Key       = x.Key,
                Value     = x.Value,
                PreSelect = x.PreSelect
            }).ToList();

            return(DataWrapper(new { drives, engines, transmissions, vehicleoptions }, drives.Count()));
        }