Exemple #1
0
        public ActionResult Edit(Videos collection)
        {
            VideosDao bdDao = new VideosDao();

            try
            {
                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];

                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();


                if (bdDao.Update(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordSucess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                return(View());
            }
        }
Exemple #2
0
        public ActionResult Create(Videos collection)
        {
            try
            {
                VideosDao bdDao = new VideosDao();

                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];
                collection.CreateBy     = us.UserName;
                collection.CreateDate   = Hepper.GetDateServer();
                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();
                collection.LanguageID   = "vi";
                //collection.CreateBy = us.UserName;
                //collection.ModifiedBy = us.UserName;
                if (bdDao.Insert(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordSuccess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                return(View());
            }
        }
Exemple #3
0
        public ActionResult Delete(long id)
        {
            try
            {
                // TODO: Add delete logic here

                VideosDao bdDao = new VideosDao();

                bdDao.Delete(id);
                // SetAlert("Xóa thành công", "success");
                return(RedirectToAction("Index"));
            }
            catch
            {
                // SetAlert("Không xóa được", "danger");
                return(View());
            }
        }
        // GET: Videos
        public ActionResult Index()
        {
            // int page = 1, int pageSize = 10
            //int totalRecord = 0;
            //var model = new VideosDao().ListActivePaging(ref  totalRecord, page, pageSize);
            var model = new VideosDao().ToListActive();

            //ViewBag.Page = page;

            //int maxPage = 5;
            //int totalPage = 0;

            //totalPage = (int)Math.Ceiling((double)(totalRecord / pageSize)) + 1;
            //ViewBag.TotalPage = totalPage;
            //ViewBag.MaxPage = maxPage;
            //ViewBag.First = 1;
            //ViewBag.Last = totalPage;
            //ViewBag.Next = page + 1;
            //ViewBag.Prev = page - 1;

            return(View(model));
        }
Exemple #5
0
        // GET: Admin/Video/Edit/5
        public ActionResult Edit(long id)
        {
            VideosDao db = new VideosDao();

            return(View(db.FindByID(id)));
        }
Exemple #6
0
        // GET: Admin/Video
        public ActionResult Index()
        {
            VideosDao db = new VideosDao();

            return(View(db.ToList()));
        }