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

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

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

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