//details for graph - nu of recommendations in each city public JsonResult getGraphD() { List <getNumRest> citys = new List <getNumRest>(); var result = (from re in db.rests join r in db.RecommendationsRest on re.ID equals r.RestID group re by new { re.restCity } into gr select new { gr.Key.restCity, Amount = gr.Count() } ); foreach (var x in result) { getNumRest sum = new getNumRest(); sum.State = x.restCity; sum.freq = x.Amount; citys.Add(sum); } return(Json(citys, JsonRequestBehavior.AllowGet)); }
//details for graph - num of rest in each city public JsonResult getGraphC() { List <getNumRest> citys = new List <getNumRest>(); var result = (from du in db.rests group du by new { du.restCity } into gr select new { gr.Key.restCity, Amount = gr.Count() } ); foreach (var x in result) { getNumRest sum = new getNumRest(); sum.State = x.restCity; sum.freq = x.Amount; citys.Add(sum); } return(Json(citys, JsonRequestBehavior.AllowGet)); }