// ModelStateを取得 public static ModelStateDictionary GetModelState(this ITempDataDictionary tempData) { var json = tempData[_modelStateKey] as string; if (string.IsNullOrWhiteSpace(json)) { return(null); } return(JsonConvertHelper.DeerializeModelState(json)); }
// ModelStateを追加 public static void AddModelState(this ITempDataDictionary tempData, ModelStateDictionary modelState) { var json = JsonConvertHelper.SerializeModelState(modelState); tempData.Add(_modelStateKey, json); }