示例#1
0
        // ModelStateを取得
        public static ModelStateDictionary GetModelState(this ITempDataDictionary tempData)
        {
            var json = tempData[_modelStateKey] as string;

            if (string.IsNullOrWhiteSpace(json))
            {
                return(null);
            }

            return(JsonConvertHelper.DeerializeModelState(json));
        }
示例#2
0
        // ModelStateを追加
        public static void AddModelState(this ITempDataDictionary tempData, ModelStateDictionary modelState)
        {
            var json = JsonConvertHelper.SerializeModelState(modelState);

            tempData.Add(_modelStateKey, json);
        }