// Làm nhiệm vụ validate account, trả về một dictionary các lỗi. public Dictionary <string, string> CheckValidate() { YYAccountModel model = new YYAccountModel(); Dictionary <string, string> errors = new Dictionary <string, string>(); if (string.IsNullOrEmpty(this._username)) { errors.Add("username", "Username can not be null or empty."); } else if (this._username.Length < 6) { errors.Add("username", "Username is too short. At least 6 characters."); } else if (model.CheckExistUsername(this._username)) { // Check trùng username. errors.Add("username", "Username is exist. Please try another one."); } if (_cpassword != _password) { errors.Add("password", "Confirm password does not match."); } // if else if else ... return(errors); }