예제 #1
0
 public ActionResult Edit([Bind(Include = "StudentID,FullName,NIF,DateOfBirth,CC,Phone,Email,Gender,Address,PostalCode,IBAN,AdmissionDay,CourseID")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseID = new SelectList(Combos.GetCourses(), "CourseID", "Name", student.CourseID);
     return(View(student));
 }
예제 #2
0
        // GET: Students/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Student student = db.Students.Find(id);

            if (student == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CourseID = new SelectList(Combos.GetCourses(), "CourseID", "Name", student.CourseID);
            return(View(student));
        }
예제 #3
0
 // GET: Students/Create
 public ActionResult Create()
 {
     ViewBag.CourseID = new SelectList(Combos.GetCourses(), "CourseID", "Name");
     return(View());
 }