Skip to content

Commit 5e2cfa4

Browse files
committed
upgrade newtonsoft.
2 parents 3d3bc18 + 27d6e07 commit 5e2cfa4

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Incoding.SiteTest.Domain
2+
{
3+
public class QueryThrowIncException
4+
{
5+
6+
}
7+
}

‎src/Incoding/MvcContrib/Core/IncControllerBase.cs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,19 @@ protected ActionResult TryPush(CommandComposite composite, Action<IncTryPushSett
9494
return TryPush(commandComposite => dispatcher.Push(commandComposite), composite, action);
9595
}
9696

97-
protected ActionResult TryPush(Action<CommandComposite> push, CommandComposite composite, Action<IncTryPushSetting> action = null)
97+
protected ActionResult TryPush(Action<CommandComposite> push, CommandComposite composite, Action<IncTryPushSetting> action = null, bool? isAjax = null)
9898
{
9999
var setting = new IncTryPushSetting();
100100
action.Do(r => r(setting));
101101

102102
Func<ActionResult> defaultSuccess = () => View(composite.Parts[0]);
103-
if (HttpContext.Request.IsAjaxRequest())
103+
var isActualAjax = isAjax.GetValueOrDefault(HttpContext.Request.IsAjaxRequest());
104+
if (isActualAjax)
104105
defaultSuccess = () => IncodingResult.Success();
105106
var success = setting.SuccessResult ?? defaultSuccess;
106107

107108
Func<IncWebException, ActionResult> defaultError = (ex) => View(composite.Parts[0]);
108-
if (HttpContext.Request.IsAjaxRequest())
109+
if (isActualAjax)
109110
defaultError = (ex) => IncodingResult.Error(ModelState);
110111
var error = setting.ErrorResult ?? defaultError;
111112

‎src/Incoding/MvcContrib/MVD/DispatcherControllerBase.cs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ public virtual ActionResult Query()
3737
if (parameter.IsValidate && !ModelState.IsValid)
3838
return IncodingResult.Error(ModelState);
3939

40-
return IncJson(dispatcher.Query(new MVDExecute(HttpContext)
41-
{
42-
Instance = new CommandComposite((IMessage)query)
43-
}));
40+
var composite = new CommandComposite((IMessage)query);
41+
return TryPush(commandComposite => dispatcher.Query(new MVDExecute(HttpContext) { Instance = composite }), composite, setting => setting.SuccessResult = () => IncodingResult.Success(composite.Parts[0].Result), isAjax: true);
4442
}
4543

4644
public virtual ActionResult Render()

0 commit comments

Comments
 (0)