/// <summary> /// ValidModel /// </summary> /// <typeparam name="T"></typeparam> /// <param name="model"></param> /// <returns></returns> protected virtual bool ValidModel <T>(T model) { if (this.m_modelState == null) { this.m_modelState = new ModelStateBinder(this); } return(this.m_modelState.IsValid(model)); }
/// <summary> /// Dispose /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { this.m_form = null; this.m_files = null; this.m_modelState = null; this.m_queryString = null; base.Dispose(disposing); }
/// <summary> /// GetModel /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> protected virtual T GetModel <T>() { T model = default(T); if (this.IsJson) { if (!string.IsNullOrEmpty(this.RequestBody)) { try { model = Newtonsoft.Json.JsonConvert.DeserializeObject <T>(this.RequestBody); } catch { } } } else { if (this.m_modelState == null) { this.m_modelState = new ModelStateBinder(this); } model = this.m_modelState.Get <T>(); } return(model); }