Ejemplo n.º 1
0
        //
        // GET: /LecturerEnrollment/Details/5

        public ActionResult Details(int id)
        {
            using (UniversitySystemContextDb db = new UniversitySystemContextDb())
            {
                return(View(db.Lecturers.Where(l => l.LecturerId == id).FirstOrDefault()));
            }
        }
Ejemplo n.º 2
0
        //
        // GET: /Course/Details/5

        public ActionResult Details(int id)
        {
            using (UniversitySystemContextDb db = new UniversitySystemContextDb())
            {
                return(View(db.Courses.Where(c => c.CourseId == id).FirstOrDefault()));
            }
        }
Ejemplo n.º 3
0
        //
        // GET: /Student/Delete/5

        public ActionResult Delete(int id)
        {
            using (UniversitySystemContextDb db = new UniversitySystemContextDb())
            {
                return(View(db.Students.Where(s => s.StudentId == id).FirstOrDefault()));
            }
        }
Ejemplo n.º 4
0
        //public ActionResult AssignLecture(int id = 0)
        //{
        //}

        // GET: /Course/Create

        public ActionResult Create()
        {
            Course assignLecturer = new Course();

            using (UniversitySystemContextDb db = new UniversitySystemContextDb())
            {
                assignLecturer.Assign = db.Lecturers.ToList <Lecturer>();
            }
            return(View(assignLecturer));
        }
Ejemplo n.º 5
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                using (UniversitySystemContextDb db = new UniversitySystemContextDb())
                {
                    Course course = db.Courses.Where(c => c.CourseId == id).FirstOrDefault();
                    db.Courses.DeleteObject(course);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 6
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                using (UniversitySystemContextDb db = new UniversitySystemContextDb())
                {
                    Student student = db.Students.Where(s => s.StudentId == id).FirstOrDefault();
                    db.Students.DeleteObject(student);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                using (UniversitySystemContextDb db = new UniversitySystemContextDb())
                {
                    Lecturer lecturer = db.Lecturers.Where(l => l.LecturerId == id).FirstOrDefault();
                    db.Lecturers.DeleteObject(lecturer);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                using (UniversitySystemContextDb db = new UniversitySystemContextDb())
                {
                    //Student enroll = db.Students.Where(e => e.StudentId == id).FirstOrDefault();
                    StudentsEnrollment enroll = db.StudentsEnrollments.SingleOrDefault(e => e.EnrollmentId == id);
                    db.StudentsEnrollments.DeleteObject(enroll);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }