Exemplo n.º 1
0
        public ActionResult Suataikhoan(string id, ThongtinnguoidungModel collection)
        {
            ThongtinnguoidungModel res = new ThongtinnguoidungModel();
            ThongtinnguoidungDao   dao = new ThongtinnguoidungDao();

            res.listtaikhoan = dao.Listtaikhoan();
            res.listchucvu   = dao.Listchucvu();
            res.listquyen    = dao.Listquyen();
            var kt = dao.timtaikhoan(collection.taikhoan.Tentaikhoan);

            if (kt.Matkhau == collection.taikhoan.Matkhau)
            {
                collection.taikhoan.Matkhau = kt.Matkhau;
            }
            else
            {
                collection.taikhoan.Matkhau = Encryptor.Encrypt(collection.taikhoan.Tentaikhoan, collection.taikhoan.Matkhau);
            }
            var check = dao.Suataikhoan(collection.taikhoan);

            dao.suathongtin(collection.taikhoan.Tentaikhoan, collection.thongtinnguoidung);
            if (ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }
            return(View("~/Areas/Admin/Views/Thongtinnguoidung/Index.cshtml", res));
        }
Exemplo n.º 2
0
        // GET: Admin/Thongtinnguoidung
        public ActionResult Index()
        {
            var dao = new ThongtinnguoidungDao();
            ThongtinnguoidungModel res = new ThongtinnguoidungModel();

            res.listtaikhoan   = dao.Listtaikhoan();
            res.listchucvu     = dao.Listchucvu();
            res.listquyen      = dao.Listquyen();
            ViewBag.Ichucvu    = dao.Ichucvu();
            ViewBag.Itrangthai = dao.ITrangthai;
            ViewBag.show       = "false";
            ViewBag.check      = "false";
            return(View(res));
        }
Exemplo n.º 3
0
        public ActionResult Themtaikhoan(ThongtinnguoidungModel collection)
        {
            var dao = new ThongtinnguoidungDao();
            ThongtinnguoidungModel res = new ThongtinnguoidungModel();

            res.listtaikhoan = dao.Listtaikhoan();
            res.listchucvu   = dao.Listchucvu();
            res.listquyen    = dao.Listquyen();
            var check = dao.Themtaikhoan(collection.taikhoan);

            ViewBag.Ichucvu    = dao.Ichucvu();
            ViewBag.Itrangthai = dao.ITrangthai;

            if (check == true)
            {
                dao.Themthongtin(collection.taikhoan.Tentaikhoan, collection.thongtinnguoidung);
                return(RedirectToAction("Index"));
            }
            ViewBag.show  = "true";
            ViewBag.check = "true";
            ModelState.AddModelError("", "Tài khoản đã tồn tại");
            return(View("~/Areas/Admin/Views/Thongtinnguoidung/Index.cshtml", res));
        }