示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Student student = StudentDB.GetStudent(db, id);

            StudentDB.DeleteStudent(db, student);
            return(RedirectToAction("Index"));
        }
示例#2
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Student student = StudentDB.GetStudent(db, id.Value);

            if (student == null)
            {
                return(HttpNotFound());
            }

            return(View(student));
        }
示例#3
0
        public ActionResult Edit(int?id)
        {
            //make sure an id is passed in or return error
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Student student = StudentDB.GetStudent(db, id.Value);

            //if student not found return not found page
            if (student == null)
            {
                return(HttpNotFound());
            }

            return(View(student));
        }
示例#4
0
        public ActionResult Details(int?id)
        {
            //make sure an id value is passed in
            if (id == null)
            {
                //return error page if no id was passed in
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Student student = StudentDB.GetStudent(db, id.Value);

            //if student was not found, return not found error page
            if (student == null)
            {
                return(HttpNotFound());
            }

            return(View(student));
        }