Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Tbl_BaiViet tbl_BaiViet = db.Tbl_BaiViet.Find(id);

            db.Tbl_BaiViet.Remove(tbl_BaiViet);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Details(int id)
        {
            Tbl_BaiViet tbl_BaiViet = db.Tbl_BaiViet.Find(id);

            if (tbl_BaiViet == null)
            {
                return(HttpNotFound());
            }
            ViewBag.lstBVLQ = db.Tbl_BaiViet.Where(x => x.maBaiViet != id).ToList();
            return(View(tbl_BaiViet));
        }
Exemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "maBaiViet,tenBaiViet,noiDung,hinhBV,maLoai,ngayDang")] Tbl_BaiViet tbl_BaiViet)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tbl_BaiViet).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tbl_BaiViet));
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "maBaiViet,tenBaiViet,noiDung,hinhBV,maLoai,ngayDang")] Tbl_BaiViet tbl_BaiViet)
        {
            if (ModelState.IsValid)
            {
                db.Tbl_BaiViet.Add(tbl_BaiViet);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.maLoai = new SelectList(db.Tbl_LoaiBaiViet, "maLoai", "TenLoai");
            return(View(tbl_BaiViet));
        }
Exemplo n.º 5
0
        // GET: BaiViet/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tbl_BaiViet tbl_BaiViet = db.Tbl_BaiViet.Find(id);

            if (tbl_BaiViet == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_BaiViet));
        }
Exemplo n.º 6
0
        // GET: BaiViet/Edit/5
        public ActionResult Edit(int id)
        {
            Tbl_BaiViet tbl_BaiViet = db.Tbl_BaiViet.Find(id);

            if (tbl_BaiViet == null)
            {
                return(HttpNotFound());
            }
            DateTime birth = Convert.ToDateTime(tbl_BaiViet.ngayDang);

            ViewBag.birth  = birth.ToString("yyyy-MM-dd");
            ViewBag.maLoai = db.Tbl_LoaiBaiViet.ToList();
            return(View(tbl_BaiViet));
        }