コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Schoole schoole = db.Schooles.Find(id);

            db.Schooles.Remove(schoole);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name")] Schoole schoole)
 {
     if (ModelState.IsValid)
     {
         db.Entry(schoole).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(schoole));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,Name")] Schoole schoole)
        {
            if (ModelState.IsValid)
            {
                db.Schooles.Add(schoole);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

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

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