public int Test1_AutoCheck(TestSerializerModel model) { //if( System.Web.HttpContext.Current.Request.ContentType.StartsWith("application/json") ) // model.DtValue = model.DtValue.ToLocalTime(); string xml1 = model.ToString(); string xml2 = s_lastTestSerializerModel.ToString(); return(xml1 == xml2 ? 1 : 0); }
public int Test2_AutoCheck(string stringVal, int intVal, DateTime dtValue, decimal money, Guid guid) { //if( System.Web.HttpContext.Current.Request.ContentType.StartsWith("application/json") ) // dtValue = dtValue.ToLocalTime(); TestSerializerModel model = TestSerializerModel.Create(stringVal, intVal, dtValue, money, guid); string xml1 = model.ToString(); string xml2 = s_lastTestSerializerModel.ToString(); return(xml1 == xml2 ? 1 : 0); }
private TestSerializerModel GetTestSerializerModel() { Random rand = new Random(); s_lastTestSerializerModel = new TestSerializerModel { StringVal = "Fish Li", DtValue = DateTime.Now, IntVal = rand.Next(10, 100), Money = Math.Round(1000M * (decimal)rand.NextDouble(), 4), Guid = Guid.NewGuid() }; return(s_lastTestSerializerModel); }
public string Test2(string stringVal, int intVal, DateTime dtValue, decimal money, Guid guid) { TestSerializerModel model = TestSerializerModel.Create(stringVal, intVal, dtValue, money, guid); return(model.ToString()); }
public string Test1(TestSerializerModel model) { return(model.ToString()); }
public object GetJson() { TestSerializerModel model = GetTestSerializerModel(); return(new JsonResult(model)); }
public object GetXml() { TestSerializerModel model = GetTestSerializerModel(); return(new XmlResult(model)); }