public void Edit(SaveNguoiDungDTO SaveNguoiDungDTO)
        {
            NguoiDung NguoiDung = _mapper.Map <SaveNguoiDungDTO, NguoiDung>(SaveNguoiDungDTO);

            _unitOfWork.NguoiDungs.Update(NguoiDung);
            _unitOfWork.Complete();
        }
        public SaveNguoiDungDTO GetSaveNguoiDungDTO(int id)
        {
            NguoiDungDTO NguoiDungDTO = GetNguoiDung(id);

            if (NguoiDungDTO == null)
            {
                return(null);
            }
            SaveNguoiDungDTO saveNguoiDungDTO = _mapper.Map <NguoiDungDTO, SaveNguoiDungDTO>(NguoiDungDTO);

            return(saveNguoiDungDTO);
        }
Ejemplo n.º 3
0
        public IActionResult Edit(SaveNguoiDungDTO saveNguoiDungDTO)
        {
            if (KiemTraDangNhap() == false)
            {
                return(View("../Login/Index"));
            }

            if (!ModelState.IsValid)
            {
                return(View(saveNguoiDungDTO));
            }
            _services.Edit(saveNguoiDungDTO);
            return(RedirectToAction("Index"));
        }
        public int Create(string NhapLaiMatKhau, SaveNguoiDungDTO SaveNguoiDungDTO)
        {
            if (!SaveNguoiDungDTO.MatKhau.Equals(NhapLaiMatKhau))
            {
                return(-1);
            }
            using (MD5 mD5 = MD5.Create())
            {
                SaveNguoiDungDTO.MatKhau = GetMd5Hash(mD5, SaveNguoiDungDTO.MatKhau);
            }
            NguoiDung NguoiDung = _mapper.Map <SaveNguoiDungDTO, NguoiDung>(SaveNguoiDungDTO);

            _unitOfWork.NguoiDungs.Add(NguoiDung);
            _unitOfWork.Complete();
            return(1);
        }
Ejemplo n.º 5
0
        public IActionResult Create(string NhapLaiMatKhau, SaveNguoiDungDTO SaveNguoiDungDTO)
        {
            if (KiemTraDangNhap() == false)
            {
                return(View("../Login/Index"));
            }
            if (!ModelState.IsValid)
            {
                return(View(NhapLaiMatKhau, SaveNguoiDungDTO));
            }
            int i = _services.Create(NhapLaiMatKhau, SaveNguoiDungDTO);

            if (i == -1)
            {
                ViewBag.MessageErrorNhapLaiMatKhau = "Mật khẩu nhập lại không khớp";
                return(View(SaveNguoiDungDTO));
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        public IActionResult Edit(int?id)
        {
            if (KiemTraDangNhap() == false)
            {
                return(View("../Login/Index"));
            }

            if (id == null)
            {
                return(RedirectToAction("Index"));
            }
            SaveNguoiDungDTO saveNguoiDungDTO = _services.GetSaveNguoiDungDTO(id.Value);

            if (saveNguoiDungDTO == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(saveNguoiDungDTO));
        }