Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LoaiSach loaiSach = db.LoaiSachs.Find(id);

            db.LoaiSachs.Remove(loaiSach);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "MaLoai,Tenloai")] LoaiSach loaiSach)
 {
     if (ModelState.IsValid)
     {
         db.Entry(loaiSach).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(loaiSach));
 }
Exemple #3
0
        public ActionResult Create([Bind(Include = "MaLoai,Tenloai")] LoaiSach loaiSach)
        {
            if (ModelState.IsValid)
            {
                db.LoaiSachs.Add(loaiSach);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(loaiSach));
        }
Exemple #4
0
        // GET: LoaiSaches/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LoaiSach loaiSach = db.LoaiSachs.Find(id);

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