コード例 #1
0
        // GET: Class/Delete/5
        public ActionResult Delete(int id)
        {
            //if (id == null) return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            vClass theClass = db.vClasses.Find(id);

            if (theClass == null)
            {
                return(HttpNotFound());
            }
            return(View(theClass));
        }
コード例 #2
0
 public ActionResult Delete(vClass theClass)
 {
     if (ModelState.IsValid)
     {
         try {
             db.vClasses.Remove(theClass);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); }
     }
     return(View(theClass));
 }
コード例 #3
0
        // GET: Class/Create
        public ActionResult Create()
        {
            vClass theClass = new vClass();

            return(View(theClass));
        }