public ActionResult Index() { var last = (from t in db.TALABA join p in db.PRIKAZ on t.Id_student equals p.Id_stud join u in db.USPEVAEM on p.Id_prikaz equals u.Id_prikaz join r in db.RAB_PLAN on u.Id_rabplan equals r.Id_rabplan where p.spec==502 select new uGruppa{nomer_zachetkiy =t.nom_zach, familiya = t.familiya,predmet = r.predmet ,itbal = u.itbal, semestr = r.semestr}); return View(last.Where(g=>g.familiya == "Коновалов" && g.semestr == 3)); } public class uGruppa { public int Id { get; set; } public string familiya { get; set; } public string predmet { get; set; } public decimal? itbal { get; set; } public int? spec { get; set; } public byte? semestr { get; set; } public int fak { get; set; } public int kurs { get; set; } public short? ucheb_god { get; set; } public int yaz { get; set; } public string nomer_zachetkiy { get; set; } } @model IEnumerable<D_V3._0.Models.uGruppa> <div class="container"> <table class="table"> <thead> <tr> <th scope="col">Ф.И.О.</th> <th scope="col">№ зачетки</th> @foreach (var item in Model) { <th scope="col">@Html.DisplayFor(modelItem => item.predmet)</th> } </tr> </thead> <tbody> @foreach (var item1 in Model) { <tr> <td> @Html.DisplayFor(modelItem => item1.familiya) </td> <td> @Html.DisplayFor(modelItem => item1.itbal) </td> </tr> } </tbody> </table> </div>
You need to get the name only once, and the points are placed under the subject, there will be a list of students. I understand, most likely I didn’t connect correctly, my level is also quite low, I will accept any help. Thank.