public ActionResult DeleteConfirmed(int id)
        {
            admin_thanhvien admin_thanhvien = db.admin_thanhvien.Find(id);

            db.admin_thanhvien.Remove(admin_thanhvien);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,tenthanhvien,motasoluoc,chitiet,urlhinhanh,ngaytao,ngaycapnhat,nguoitao,daxoa,ghichu,nhomthanhvien,hienthi,tenthanhvien_en,motasoluoc_en,chitiet_en,thutuhienthi")] admin_thanhvien admin_thanhvien)
 {
     if (ModelState.IsValid)
     {
         db.Entry(admin_thanhvien).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.nguoitao      = new SelectList(db.admin_account, "id", "username", admin_thanhvien.nguoitao);
     ViewBag.nhomthanhvien = new SelectList(db.admin_nhomthanhvien, "id", "tennhomthanhvien", admin_thanhvien.nhomthanhvien);
     return(View(admin_thanhvien));
 }
        // GET: Admin/admin_thanhvien1/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            admin_thanhvien admin_thanhvien = db.admin_thanhvien.Find(id);

            if (admin_thanhvien == null)
            {
                return(HttpNotFound());
            }
            return(View(admin_thanhvien));
        }
Exemplo n.º 4
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            admin_thanhvien admin_thanhvien = db.admin_thanhvien.Find(id);

            //db.admin_thanhvien.Remove(admin_thanhvien);
            admin_thanhvien.ngaycapnhat     = DateTime.Now;
            admin_thanhvien.daxoa           = true;
            db.Entry(admin_thanhvien).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: Admin/admin_thanhvien1/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            admin_thanhvien admin_thanhvien = db.admin_thanhvien.Find(id);

            if (admin_thanhvien == null)
            {
                return(HttpNotFound());
            }
            ViewBag.nguoitao      = new SelectList(db.admin_account, "id", "username", admin_thanhvien.nguoitao);
            ViewBag.nhomthanhvien = new SelectList(db.admin_nhomthanhvien, "id", "tennhomthanhvien", admin_thanhvien.nhomthanhvien);
            return(View(admin_thanhvien));
        }
Exemplo n.º 6
0
        // GET: Admin/ThanhVien/Details/5
        public ActionResult Details(int?id)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            admin_thanhvien admin_thanhvien = db.admin_thanhvien.Find(id);

            if (admin_thanhvien == null)
            {
                return(HttpNotFound());
            }
            return(View(admin_thanhvien));
        }
Exemplo n.º 7
0
        public ActionResult Detail(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            admin_thanhvien admin_thanhvien = db.admin_thanhvien.Find(id);

            if (admin_thanhvien == null)
            {
                return(HttpNotFound());
            }
            ViewBag.hinhdaidien = @"../.." + admin_thanhvien.urlhinhanh;

            var arr_imgBanner = db.banners.Where(s => s.loaibanner1.id == (int)LoaiBannerEnum.Thanhvien && s.hienthi == true)
                                .OrderBy(s => s.thutuhien).Select(s => s.urlbanner).FirstOrDefault();

            ViewBag.arrBanner  = "../.." + arr_imgBanner;
            ViewBag.motasoluoc = admin_thanhvien.motasoluoc;
            return(View(admin_thanhvien));
        }
Exemplo n.º 8
0
        public ActionResult Create([Bind(Include = "id,tenthanhvien,tenthanhvien_en,motasoluoc,motasoluoc_en,chitiet,chitiet_en,urlhinhanh,ngaytao,ngaycapnhat,nguoitao,daxoa,ghichu,nhomthanhvien,hienthi")] admin_thanhvien admin_thanhvien)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            if (ModelState.IsValid)
            {
                if (Session["User"] != null)
                {
                    admin_account u = Session["User"] as admin_account;
                    admin_thanhvien.nguoitao = u.id;
                }
                admin_thanhvien.ngaytao     = DateTime.Now;
                admin_thanhvien.ngaycapnhat = DateTime.Now;
                db.admin_thanhvien.Add(admin_thanhvien);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.nguoitao      = new SelectList(db.admin_account, "id", "username", admin_thanhvien.nguoitao);
            ViewBag.nhomthanhvien = new SelectList(db.admin_nhomthanhvien, "id", "tennhomthanhvien", admin_thanhvien.nhomthanhvien);
            return(View(admin_thanhvien));
        }