Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Tailieu tailieu = db.tailieus.Find(id);

            db.tailieus.Remove(tailieu);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "ID,Title,ReleaseDate,GenreID,Price,Picture,Rating,Sumary")] Tailieu tailieu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tailieu).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GenreID = new SelectList(db.genres, "genreID", "genreName", tailieu.GenreID);
     return(View(tailieu));
 }
Exemplo n.º 3
0
        // GET: Tailieux/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tailieu tailieu = db.tailieus.Find(id);

            if (tailieu == null)
            {
                return(HttpNotFound());
            }
            return(View(tailieu));
        }
Exemplo n.º 4
0
        // GET: Tailieux/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tailieu tailieu = db.tailieus.Find(id);

            if (tailieu == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GenreID = new SelectList(db.genres, "genreID", "genreName", tailieu.GenreID);
            return(View(tailieu));
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "ID,Title,ReleaseDate,GenreID,Price,Picture,Rating,Sumary")] Tailieu tailieu)
        {
            tailieu.Picture = new byte[tailieu.PictureUpload.ContentLength];
            tailieu.PictureUpload.InputStream.Read(tailieu.Picture, 0, tailieu.PictureUpload.ContentLength);

            if (ModelState.IsValid)
            {
                db.tailieus.Add(tailieu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.GenreID = new SelectList(db.genres, "genreID", "genreName", tailieu.GenreID);
            return(View(tailieu));
        }