Ejemplo n.º 1
0
        // GET: Admin/KyThu
        public ActionResult Index(int page = 1, int pageSize = 10)
        {
            var dao   = new KyThuDao();
            var model = dao.ListAllPaging(page, pageSize);

            return(View(model));
        }
Ejemplo n.º 2
0
        // GET: Admin/KyThu/Edit/5
        public ActionResult Edit(int id)
        {
            var dao     = new KyThuDao();
            var content = dao.GetByID(id);



            return(View(content));
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int id, kythu collection)
        {
            if (ModelState.IsValid)
            {
                var dao = new KyThuDao();



                var result = dao.Update(collection, id);
                if (result)
                {
                    return(RedirectToAction("Index", "KyThu"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật không thành công");
                }
            }
            return(View("Index"));
        }
Ejemplo n.º 4
0
        public ActionResult Create(kythu collection)
        {
            if (ModelState.IsValid)
            {
                var dao = new KyThuDao();



                long id = dao.Insert(collection);
                if (id > 0)
                {
                    return(RedirectToAction("Index", "KyThu"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm Kỳ Thu không thành công");
                }
            }
            return(View("Index"));
        }