public ActionResult 修改客戶資料()
        {
            FormsIdentity id   = (FormsIdentity)HttpContext.User.Identity;
            客戶資料          客戶資料 = repo.FindByAccount(id.Name);

            return(View(客戶資料));
        }
Example #2
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var user = repo.FindByAccount(this.Username);

            if (this.Username == "test" && this.Password == "1234")
            {
                yield return(ValidationResult.Success);

                yield break;
            }
            else if (user != null && user.密碼 == Crypto.SHA1(this.Password))
            {
                yield return(ValidationResult.Success);

                yield break;
            }
            if (this.Password != "1234")
            {
                //yield return new ValidationResult("帳戶錯誤", new string[]{"Username" });
                //yield return new ValidationResult("密碼錯誤", new string[] { "Password" });
                yield return(new ValidationResult("帳號或密碼錯誤"));

                yield break;
            }
        }