Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            StudentsSubjects studentsSubjects = db.StudentsSubjects.Find(id);

            db.StudentsSubjects.Remove(studentsSubjects);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Scores,StudentId,YearId,SubjectsId")] StudentsSubjects studentsSubjects)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentsSubjects).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentId  = new SelectList(db.Students, "Id", "FirstName", studentsSubjects.StudentId);
     ViewBag.SubjectsId = new SelectList(db.Subjects, "SubjectsId", "SubjectName", studentsSubjects.SubjectsId);
     ViewBag.YearId     = new SelectList(db.Years, "YearId", "YearName", studentsSubjects.YearId);
     return(View(studentsSubjects));
 }
Beispiel #3
0
        // GET: StudentsSubjects/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentsSubjects studentsSubjects = db.StudentsSubjects.Find(id);

            if (studentsSubjects == null)
            {
                return(HttpNotFound());
            }
            return(View(studentsSubjects));
        }
Beispiel #4
0
        // GET: StudentsSubjects/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentsSubjects studentsSubjects = db.StudentsSubjects.Find(id);

            if (studentsSubjects == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StudentId  = new SelectList(db.Students, "Id", "FirstName", studentsSubjects.StudentId);
            ViewBag.SubjectsId = new SelectList(db.Subjects, "SubjectsId", "SubjectName", studentsSubjects.SubjectsId);
            ViewBag.YearId     = new SelectList(db.Years, "YearId", "YearName", studentsSubjects.YearId);
            return(View(studentsSubjects));
        }