예제 #1
0
        public ActionResult Edit(TrinhDo trinhDo)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    var _trinhDoDao = new TrinhDoDao();

                    var res = _trinhDoDao.Update(trinhDo);
                    if (res)
                    {
                        return(RedirectToAction("Index", "TrinhDo"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Cập nhật lỗi");
                    }
                }

                return(View(trinhDo));
            }
            catch
            {
                return(RedirectToAction("Index", "TrinhDo"));
            }
        }
예제 #2
0
        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var trinhDoDao   = new TrinhDoDao();
            var modelTrinhDo = trinhDoDao.ListAllPaging(searchString, page, pageSize);

            return(View(modelTrinhDo));
        }
예제 #3
0
        public ActionResult EditLevel(TrinhDo trinhDo)
        {
            var _daoTrinhDo = new TrinhDoDao();

            var res = _daoTrinhDo.Update(trinhDo);

            return(View());
        }
예제 #4
0
        public ActionResult Create(TrinhDo trinhDo)
        {
            // TODO: Add insert logic here
            var trinhDoDao = new TrinhDoDao();

            int maTrinhDo = trinhDoDao.Insert(trinhDo);

            if (maTrinhDo > 0)
            {
                return(RedirectToAction("Index", "TrinhDo"));
            }
            else
            {
                ModelState.AddModelError("", "Thêm thất bại");
            }

            return(View(trinhDo));
        }
예제 #5
0
        // GET: TrinhDo/Edit/5
        public ActionResult Edit(int id)
        {
            var trinhDo = new TrinhDoDao().ViewDetails(id);

            return(View(trinhDo));
        }
예제 #6
0
        // GET: TrinhDo/Details/5
        public ActionResult Details(int id)
        {
            var model = new TrinhDoDao().ViewDetails(id);

            return(View(model));
        }