public async Task <ActionResult> Create(CreateWebAppDto dto) { var command = dto.ToCommand(); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { ModelState.AddModelError(string.Empty, result.GetErrorMessage()); return(View()); } return(RedirectToAction("Index")); }
public async Task <ActionResult> CreateWebApp(CreateWebAppDto dto) { if (!ModelState.IsValid) { return(Json(new { Success = false, Message = ModelState.GetFirstError() })); } var command = dto.ToCommand(); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(Json(new { Success = false, Message = result.GetErrorMessage() })); } return(Json(new { Success = true, Message = "系统注册成功" })); }