コード例 #1
0
        // GET: Admin/NV
        public ActionResult Index(int page = 1, int pagesize = 5)
        {
            var accDao = new NVDao();
            var model  = accDao.ListAccountAll(page, pagesize);

            return(View(model));
        }
コード例 #2
0
        //[HttpDelete]
        public ActionResult Delete(int id)
        {
            bool result = new NVDao().Delete(id);

            if (!result)
            {
                ModelState.AddModelError("", "Chỉnh sửa tài khoản thất bại");
            }
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Tao(NHANVIEN acc)
 {
     if (ModelState.IsValid)
     {
         var    dao       = new NVDao();
         string mahoaPass = MaHoa.Instance.Encrypt(acc.Password);
         acc.Password = mahoaPass;
         int id = dao.InsertAccount(acc);
         if (id > 0)
         {
             return(RedirectToAction("Index", "NV"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm tài khoản  thất bại");
         }
     }
     return(View("DanhSachTaiKhoan"));
 }
コード例 #4
0
        public ActionResult Edit(NHANVIEN acc)
        {
            if (ModelState.IsValid)
            {
                var dao = new NVDao();
                if (!string.IsNullOrEmpty(acc.Password))
                {
                    string mahoaPass = MaHoa.Instance.Encrypt(acc.Password);
                    acc.Password = mahoaPass;
                }

                var result = dao.UpdateAccount(acc);
                if (result)
                {
                    return(RedirectToAction("Index", "NV"));
                }
                else
                {
                    ModelState.AddModelError("", "Chỉnh sửa tài khoản thất bại");
                }
            }
            return(View("Index"));
        }
コード例 #5
0
        public ActionResult Edit(int id)
        {
            var user = new NVDao().ViewDetail(id);

            return(View(user));
        }