public ActionResult Stat() { using (var db = new RejestrContext()) { var vm = from s in db.Studenci group s by s.Imie into grupa select new ViewModels.Statystyki2VM { Imie = grupa.Key, LiczbaStudentow = grupa.Count() }; return(View(vm.ToList())); } }