public override dynamic Request(KalmyContext context) { var testdates = (from o in context.Car select new { Type = o.Type }).Distinct().OrderBy(x => x.Type); JArray jArray = new JArray(); foreach (var x in testdates) { JObject jObject = new JObject(); string type = x.Type.ToString(); JProperty property = new JProperty("name", type); JArray jArray2 = new JArray(); var query = from item in context.Car where item.Type == type group item by item.Brand into g select new { CategoryName = g.Key, Count = g.Count() }; foreach (var z in query) { JObject jObjectx = new JObject(); jObjectx.Add(new JProperty("name", z.CategoryName)); jObjectx.Add(new JProperty("size", z.Count)); jArray2.Add(jObjectx); } JProperty propertyc = new JProperty("children", jArray2); jObject.Add(property); jObject.Add(propertyc); jArray.Add(jObject); } return(jArray); }
public override dynamic Request(KalmyContext context) { var query = from item in context.Car group item by item.Model into g select new { CategoryName = g.Key, Count = g.Count() }; JArray jObject = new JArray(from p in query orderby p.CategoryName select new JObject( new JProperty("name", p.CategoryName), new JProperty("value", p.Count))); return(jObject); }
public KalmyRepository(KalmyContext eventContext, ILogger <EventRepository> logger) { _eventContext = eventContext; _logger = logger; }
public abstract dynamic Request(KalmyContext context);
public KalmyRepository(KalmyContext kalmyContext, ILogger <KalmyRepository> logger) { _kalmyContext = kalmyContext; _logger = logger; }