Exemple #1
0
 public ActionResult UpdateEvent(_event model)
 {
     if (ModelState.IsValid)
     {
         var dao = new EventsDAO();
         //Kiểm tra xem tên sự kiện này đã có chưa
         bool exist = dao.EventExistForUpdate(model.Name, Convert.ToInt32(model.ID));
         if (!exist)
         {
             UserLogin userlogin = (UserLogin)Session["USER_SESSION"];
             model.ModifiedBy = userlogin.UserName;
             string metatitle = CastString.Cast(model.Name);
             model.MetaTitle = metatitle;
             bool result = dao.UpdateEvent(model);
             if (result)
             {
                 SetAltert("Cập nhật sự kiện thành công", 0);
                 return(RedirectToAction("Index", "Events"));
             }
             else
             {
                 SetAltert("Chưa cập nhật sự kiện được", 2);
             }
         }
         else
         {
             SetAltert("Sự kiện này đã tồn tại", 2);
         }
     }
     else
     {
     }
     return(View(model));
 }
Exemple #2
0
 public ActionResult CreateEvent(_event model)
 {
     if (ModelState.IsValid)
     {
         var  dao   = new EventsDAO();
         bool exits = dao.EventExist(model.Name);
         if (!exits)
         {
             //Lấy ra user đăng nhập để gán vào CreatedBY
             UserLogin userlogin = (UserLogin)Session["USER_SESSION"];
             model.CreatedBy = userlogin.UserName;
             string metatitle = CastString.Cast(model.Name);
             model.MetaTitle = metatitle;
             bool result = dao.CreateEvent(model);
             if (result)
             {
                 SetAltert("Tạo sự kiện thành công", 0);
                 return(RedirectToAction("Index", "Events"));
             }
             else
             {
                 SetAltert("Chưa tạo được sự kiện", 2);
             }
         }
         else
         {
             SetAltert("Sự kiện này đã có", 2);
         }
     }
     return(View(model));
 }
Exemple #3
0
        public ActionResult UpdateEvent(int id)
        {
            var dao   = new EventsDAO();
            var model = dao.EventDetail(id);

            return(View(model));
        }
        //Load hình các sự kiện lên rightsidebar
        public ActionResult listEventImages()
        {
            var dao   = new EventsDAO();
            var model = dao.newestEvents(9);

            return(PartialView(model));
        }
Exemple #5
0
        // GET: Admin/Product

        public ActionResult Index()
        {
            var dao   = new EventsDAO();
            var model = dao.listEvents();

            return(View(model));
        }
        //Tạo list các sự kiện sắp diễn ra
        public ActionResult NextToEvents()
        {
            var dao   = new EventsDAO();
            var model = dao.listEventsClient();

            return(PartialView(model));
        }
        //Tạo slider
        public ActionResult Eventslider()
        {
            var dao   = new EventsDAO();
            var model = dao.TopHotEvents(0, 0);

            return(PartialView(model));
        }
Exemple #8
0
        public int AddEvent()
        {
            EventsDAO dao    = new EventsDAO();
            int       result = dao.CreateEvents(this);

            return(result);
        }
        public ActionResult EventDetails(long id)
        {
            var dao   = new EventsDAO();
            int ID    = Convert.ToInt32(id);
            var model = dao.EventDetail(ID);

            return(View(model));
        }
Exemple #10
0
        public JsonResult ChageTopHot(long id)
        {
            var result = new EventsDAO().ChageTopHot(id);

            return(Json(new
            {
                status = result
            }));
        }
Exemple #11
0
        public JsonResult ChangeStatus(long id)
        {
            var result = new EventsDAO().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
Exemple #12
0
        public List <Events> Allevents()
        {
            EventsDAO dao = new EventsDAO();

            return(dao.SelectAll());
        }