public ActionResult RegistAccount(Account account) { ExecuteResult result = new ExecuteResult(); // 前端欄位驗證 if (!ModelState.IsValid) { CurrentHttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; result.IsSuccessed = false; result.Message = "請填寫必填欄位"; } else { result = _registService.RegistValid(account); if (!result.IsSuccessed) { CurrentHttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; } else { result = _registService.Regist(account); if (result.IsSuccessed) { CurrentHttpContext.Response.StatusCode = (int)HttpStatusCode.OK; } else { CurrentHttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; } } } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ExecuteResult RegistAccount(Account account) { HttpResponseMessage response = Request.CreateResponse(); ExecuteResult result = new ExecuteResult(); if (!ModelState.IsValid) { result.IsSuccessed = false; result.Message = "請填寫必填欄位"; } else { result = _registService.RegistValid(account); if (result.IsSuccessed) { result = _registService.Regist(account); } } return(result); }