hi guys I have tried to collect data between ages but there is an error I do not know why here is my code my controller
- public ActionResult AllCuont()
- { var query = (from t in db.Pations
- let range = ( t.Age >= 0 && t.Age < 10 ? "0-9" :
- t.Age >= 11 && t.Age < 15 ? "10-14" :
- t.Age >= 15 && t.Age < 50 ? "15-50" : "50+" )
- group t by range into g
- select new UserRange { AgeRange = g.Key, Count = g.Count() }).ToList();
- query.Add(new UserRange() { AgeRange = "Sum", Count = query.Sum(c => c.Count) }); ViewBag.UserData = query;
- return View(); }
and this is my model for To collect value
- namespace Archive.Models
- {
- public class UserRange {
- public string AgeRange { get; set; }
- public IEnumerable<Pation> Count { get; set; } }
- }
i Can't find the problem can you help me
the problem in my controller here