private void PrepareAndSetModel(IRazorView page, IRequest httpReq, object dto) { if (!(page is IHasModel hasModel)) { return; } if (hasModel.ModelType == typeof(DynamicRequestObject)) { dto = new DynamicRequestObject(httpReq, dto); } var model = dto ?? DeserializeHttpRequestAsync(hasModel.ModelType, httpReq, httpReq.ContentType).GetResult(); if (model.GetType().IsAnonymousType()) { model = new DynamicRequestObject(httpReq, model); } hasModel.SetModel(model); }
private void PrepareAndSetModel(IRazorView page, IHttpRequest httpReq, object dto) { var hasModel = page as IHasModel; if (hasModel == null) { return; } if (hasModel.ModelType == typeof(DynamicRequestObject)) { dto = new DynamicRequestObject(httpReq, dto); } var model = dto ?? DeserializeHttpRequest(hasModel.ModelType, httpReq, httpReq.ContentType); if (model.GetType().IsAnonymousType()) { model = new DynamicRequestObject(httpReq, model); } hasModel.SetModel(model); }
private void PrepareAndSetModel(IRazorView page, IHttpRequest httpReq, object dto) { var hasModel = page as IHasModel; if (hasModel == null) return; if (hasModel.ModelType == typeof(DynamicRequestObject)) dto = new DynamicRequestObject(httpReq, dto); var model = dto ?? DeserializeHttpRequest(hasModel.ModelType, httpReq, httpReq.ContentType); if (model.GetType().IsAnonymousType()) { model = new DynamicRequestObject(httpReq, model); } hasModel.SetModel(model); }