public ActionResult Index() { LoginController Log = new LoginController(); string i, n, tekst; Log.metoda(out i, out n); tekst = "Witaj " + i + " " + n; ViewBag.powitanie = tekst; int ID; Log.wyciaganie_ID(out ID); SzkolaEntities db = new SzkolaEntities(); Grades Grades = new Grades(); var Zmienna = (from table0 in db.User join table1 in db.Teacher on table0.UserID equals table1.UserID join table2 in db.School_Class on table1.ClassID equals table2.ClassID where table0.UserID == ID select new Grades { ClassID = table2.ClassID, Nazwa_Klasy = table2.Nazwa }).Distinct().ToList(); return(View("Index", "~/Views/Main_Layout.cshtml", Zmienna)); }
public JsonResult GetEvents() { using (SzkolaEntities School = new SzkolaEntities()) { School.Configuration.LazyLoadingEnabled = false; LoginController Log = new LoginController(); int ID; Log.wyciaganie_ID(out ID); var result = (from n in School.Teacher where n.UserID == ID select n.ClassID).Distinct().ToList(); //var result2 = Convert.ToInt32(result); var events = School.Events.ToList().Where(xx => result.Contains(xx.ClassID)); return(new JsonResult { Data = events, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
public ActionResult Student_Grades() { int UserID; LoginController Log = new LoginController(); Log.wyciaganie_ID(out UserID); SzkolaEntities db = new SzkolaEntities(); School_Grades Grades = new School_Grades(); var Pobrane = (from table2 in db.Student join table3 in db.School_Grades on table2.StudentID equals table3.StudentID join table4 in db.Teacher on table3.TeacherID equals table4.TeacherID join table5 in db.School_Class on table2.ClassID equals table5.ClassID where table2.UserID == UserID select new Grades { ClassID = table2.ClassID, Nazwa_Klasy = table5.Nazwa, Przedmiot = table4.Przedmiot, Ocena = table3.Ocena, Uwagi = table3.Uwagi, Data = table3.Data, TeacherID = table4.TeacherID }).ToList(); var ID = Pobrane.FirstOrDefault().ClassID; var Przedmioty = (from table1 in db.Teacher join table2 in db.User on table1.UserID equals table2.UserID where table1.ClassID == ID select new Grades { Imie2 = table2.Imie, Nazwisko2 = table2.Nazwisko, przedmiot2 = table1.Przedmiot }).Distinct().ToList(); ViewBag.Przedmioty = Przedmioty; return(View("Student_Grades", "~/Views/Main_Layout.cshtml", Pobrane)); }
public ActionResult Grades() { int User; LoginController Log = new LoginController(); Log.wyciaganie_ID(out User); if (TempData.ContainsKey("Informacja")) { ViewBag.Informacja = TempData["Informacja"]; } else if (TempData.ContainsKey("Brak_Danych")) { ViewBag.Informacja = TempData["Brak_Danych"]; } else if ((TempData.ContainsKey("Brak_Danych")) && TempData.ContainsKey("Informacja")) { ViewBag.Informacja = TempData["Informacja"]; } SzkolaEntities db = new SzkolaEntities(); Grades Grades = new Grades(); var Zmienna = (from table1 in db.Teacher join table2 in db.School_Class on table1.ClassID equals table2.ClassID where User == table1.UserID select new Grades { ClassID = table2.ClassID, Nazwa_Klasy = table2.Nazwa, TeacherID = table1.TeacherID, Przedmiot = table1.Przedmiot }).Distinct().ToList(); return(View("~/Views/Teacher/Grades.cshtml", "~/Views/Main_Layout.cshtml", Zmienna)); }