コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Murid murid = db.Muridd.Find(id);

            db.Muridd.Remove(murid);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        //
        // GET: /Student/Delete/5

        public ActionResult Delete(int id = 0)
        {
            Murid murid = db.Muridd.Find(id);

            if (murid == null)
            {
                return(HttpNotFound());
            }
            return(View(murid));
        }
コード例 #3
0
 public ActionResult Edit(Murid murid)
 {
     if (ModelState.IsValid)
     {
         db.Entry(murid).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.KelasID = new SelectList(db.Kelass, "KelasID", "Nama", murid.KelasID);
     return(View(murid));
 }
コード例 #4
0
        //
        // GET: /Student/Edit/5

        public ActionResult Edit(int id = 0)
        {
            Murid murid = db.Muridd.Find(id);

            if (murid == null)
            {
                return(HttpNotFound());
            }
            ViewBag.KelasID = new SelectList(db.Kelass, "KelasID", "Nama", murid.KelasID);
            return(View(murid));
        }
コード例 #5
0
        public ActionResult Create(Murid murid)
        {
            if (ModelState.IsValid)
            {
                db.Muridd.Add(murid);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.KelasID = new SelectList(db.Kelass, "KelasID", "Nama", murid.KelasID);
            return(View(murid));
        }