コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ClassFiveStudent classFiveStudent = db.ClassFiveStudents.Find(id);

            db.ClassFiveStudents.Remove(classFiveStudent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ID,Roll,Name,Email,Cell")] ClassFiveStudent classFiveStudent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(classFiveStudent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(classFiveStudent));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ID,Roll,Name,Email,Cell")] ClassFiveStudent classFiveStudent)
        {
            if (ModelState.IsValid)
            {
                db.ClassFiveStudents.Add(classFiveStudent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(classFiveStudent));
        }
コード例 #4
0
        // GET: ClassFiveStudent/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClassFiveStudent classFiveStudent = db.ClassFiveStudents.Find(id);

            if (classFiveStudent == null)
            {
                return(HttpNotFound());
            }
            return(View(classFiveStudent));
        }