Esempio n. 1
0
        public ActionResult Create([Bind(Include = "tenhanhtrinh,tenhanhtrinh_en,hinhdaidien,loaihanhtrinh,ngaytao,thongtinthoigian,thongtindiadiem,diadiem_en,motasoluoc,motasoluoc_en,noidung,noidung_en,hienthi,nguoitao")] admin_hanhtrinh admin_hanhtrinh)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            try
            {
                if (ModelState.IsValid)
                {
                    admin_hanhtrinh.ngaycapnhat = DateTime.Now;
                    if (Session["User"] != null)
                    {
                        admin_account u = Session["User"] as admin_account;
                        admin_hanhtrinh.nguoitao = u.id;
                    }
                    db.admin_hanhtrinh.Add(admin_hanhtrinh);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                ViewBag.nguoitao      = new SelectList(db.admin_account, "id", "username", admin_hanhtrinh.nguoitao);
                ViewBag.loaihanhtrinh = new SelectList(db.admin_loaihanhtrinh, "id", "tenloaihanhtrinh", admin_hanhtrinh.loaihanhtrinh);
                return(View(admin_hanhtrinh));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            admin_hanhtrinh admin_hanhtrinh = db.admin_hanhtrinh.Find(id);

            //db.admin_hanhtrinh.Remove(admin_hanhtrinh);
            admin_hanhtrinh.daxoa           = true;
            admin_hanhtrinh.ngaycapnhat     = DateTime.Now;
            db.Entry(admin_hanhtrinh).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "id,tenhanhtrinh,tenhanhtrinh_en,hinhdaidien,loaihanhtrinh,ngaytao,thongtinthoigian,thongtindiadiem,diadiem_en,motasoluoc,motasoluoc_en,noidung,noidung_en,hienthi,nguoitao")] admin_hanhtrinh admin_hanhtrinh)
 {
     if (Session["User"] == null)
     {
         return(RedirectToAction("Logout", "Account"));
     }
     if (ModelState.IsValid)
     {
         admin_hanhtrinh.ngaycapnhat     = DateTime.Now;
         db.Entry(admin_hanhtrinh).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.nguoitao      = new SelectList(db.admin_account, "id", "username", admin_hanhtrinh.nguoitao);
     ViewBag.loaihanhtrinh = new SelectList(db.admin_loaihanhtrinh, "id", "tenloaihanhtrinh", admin_hanhtrinh.loaihanhtrinh);
     return(View(admin_hanhtrinh));
 }
Esempio n. 4
0
        // GET: Admin/admin_hanhtrinh/Details/5
        public ActionResult Details(int?id)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            admin_hanhtrinh admin_hanhtrinh = db.admin_hanhtrinh.Find(id);

            if (admin_hanhtrinh == null)
            {
                return(HttpNotFound());
            }
            return(View(admin_hanhtrinh));
        }
Esempio n. 5
0
        public ActionResult Detail(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            admin_hanhtrinh admin_hanhtrinh = db.admin_hanhtrinh.Find(id);

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

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

            ViewBag.arrBanner = "../.." + arr_imgBanner;
            return(View(admin_hanhtrinh));
        }
Esempio n. 6
0
        // GET: Admin/admin_hanhtrinh/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            admin_hanhtrinh admin_hanhtrinh = db.admin_hanhtrinh.Find(id);

            if (admin_hanhtrinh == null)
            {
                return(HttpNotFound());
            }
            ViewBag.nguoitao      = new SelectList(db.admin_account, "id", "username", admin_hanhtrinh.nguoitao);
            ViewBag.loaihanhtrinh = new SelectList(db.admin_loaihanhtrinh, "id", "tenloaihanhtrinh", admin_hanhtrinh.loaihanhtrinh);
            return(View(admin_hanhtrinh));
        }