// POST: api/User public string Post(createUserViewModel viewModel) { var Session = HttpContext.Current.Session; if (!Session.isAdminSession()) { return(""); } string Error = ValidateViewModel(viewModel); if (Error == "") { if (string.IsNullOrEmpty(viewModel.MatKhau)) { return(JsonConvert. SerializeObject(new ResultViewModel( "Mật khẩu không được để trống", "Đã xảy ra lỗi trong quá trình tạo tài khoản"))); } if (!Helper.KiemTraHopLeMatKhau(viewModel.MatKhau)) { return(JsonConvert. SerializeObject(new ResultViewModel( "Mật khẩu phải có kí tự viết hoa, tối thiểu 8 kí tự", "Đã xảy ra lỗi trong quá trình tạo tài khoản"))); } if (string.IsNullOrEmpty(viewModel.MatKhau)) { return(JsonConvert. SerializeObject(new ResultViewModel( "Mật khẩu nhập lại không được để trống", "Đã xảy ra lỗi trong quá trình tạo tài khoản"))); } if (!Authentication_DAO.TaoTaiKhoan(viewModel)) { return(JsonConvert. SerializeObject(new ResultViewModel( "Email của tài khoản này đã tồn tại rồi", "Đã xảy ra lỗi trong quá trình tạo tài khoản"))); } } return(Error); }