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));
        }
        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.Student
                              where n.UserID == ID
                              select n.ClassID).Single();

                var result2 = Convert.ToInt32(result);

                var events = School.Events.ToList().Where(xx => xx.ClassID == result2);
                return(new JsonResult {
                    Data = events, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }