public IActionResult EditCourse(viewModelStudentCourse viewModel)
        {
            //get the UID from the Session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session

            //get the Course object from the DB using the DALCourse class
            DALCourses dp = new DALCourses(configuration);
            DALStudent ds = new DALStudent(configuration);

            Student stu = ds.getStudent(uID);

            dp.UpdateCourses(viewModel.AddedCourse.ClassID.ToString(), viewModel.AddedCourse.UID);
            viewModelStudentCourse courseList = new viewModelStudentCourse();

            courseList.UID = stu.UID;

            courseList.FirstName       = stu.FirstName;
            courseList.LastName        = stu.LastName;
            courseList.StudentEmail    = stu.StudentEmail;
            courseList.Courses         = new Courselist();
            courseList.Courses.Courses = dp.GetCourseAvailableForStudent(uID);

            //send the view
            // return View(courseList);
            return(RedirectToAction("EditCourse", new { uID = uID }));
        }
        public IActionResult EditCourse(int?id)
        {
            //get the UID from the Session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session

            //get the Course object from the DB using the DALCourse class
            DALCourses             dp         = new DALCourses(configuration);
            DALStudent             ds         = new DALStudent(configuration);
            Student                stu        = ds.getStudent(uID);
            viewModelStudentCourse courseList = new viewModelStudentCourse();

            courseList.UID             = stu.UID;
            courseList.AddedCourse     = new Courses();
            courseList.AddedCourse.UID = stu.UID;  /// This is new

            courseList.SelectedCourses         = new Courselist();
            courseList.SelectedCourses.Courses = dp.getCourses(stu.UID.ToString());

            courseList.FirstName       = stu.FirstName;
            courseList.LastName        = stu.LastName;
            courseList.StudentEmail    = stu.StudentEmail;
            courseList.Courses         = new Courselist();
            courseList.Courses.Courses = dp.GetCourseAvailableForStudent(uID);



            //send the view
            return(View(courseList));
        }
        public IActionResult UpdateCourse(string class1, string class2, string class3)
        {
            //get the uid from the session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session


            DALCourses dp = new DALCourses(configuration);

            dp.UpdateCourses(class1, uID);
            dp.UpdateCourses(class2, uID);
            dp.UpdateCourses(class3, uID);
            viewModelStudentCourse vwcourse = new viewModelStudentCourse();

            vwcourse.Courses         = new Courselist();
            vwcourse.Courses.Courses = new List <Courses>();
            //vwcourse.Courses.Courses.Add(dp.getCourses(class1));
            //vwcourse.Courses.Courses.Add(dp.getCourses(class2));
            //vwcourse.Courses.Courses.Add(dp.getCourses(class3));

            DALStudent ds  = new DALStudent(configuration);
            Student    stu = ds.getStudent(uID);

            vwcourse.UID          = uID;
            vwcourse.FirstName    = stu.FirstName;
            vwcourse.LastName     = stu.LastName;
            vwcourse.StudentEmail = stu.StudentEmail;
            //vwcourse.ClassTime = stu.ClassTime;
            return(View("UpdateCourse", vwcourse));
        }
        public IActionResult DeleteStudent()
        {
            //get the uid from the session
            int        uID     = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session
            DALStudent dp      = new DALStudent(configuration);
            Student    student = dp.getStudent(uID);

            dp.DeleteStudent(uID);

            return(View(student));
        }
        public IActionResult EditStudent()
        {
            //get the UID from the Session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session

            //get the Student object from the DB using the DALStudent class
            DALStudent dp      = new DALStudent(configuration);
            Student    student = dp.getStudent(uID);

            //send the view
            return(View(student));
        }
        public ActionResult EditStudent(int ID)
        {
            var dataModel = dalStudent.getStudent(ID);

            return(View(new StudentModel()
            {
                ID = dataModel.ID,
                BrIndexa = dataModel.BrIndexa,
                Grad = dataModel.Grad,
                Ime = dataModel.Ime,
                Prezime = dataModel.Prezime
            }));
        }