当前位置: 首页>>代码示例>>C#>>正文


C# Script.Serialization.JavaScriptSerializer.First方法代码示例

本文整理汇总了C#中System.Web.Script.Serialization.JavaScriptSerializer.First方法的典型用法代码示例。如果您正苦于以下问题:C# Script.Serialization.JavaScriptSerializer.First方法的具体用法?C# Script.Serialization.JavaScriptSerializer.First怎么用?C# Script.Serialization.JavaScriptSerializer.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Script.Serialization.JavaScriptSerializer的用法示例。


在下文中一共展示了Script.Serialization.JavaScriptSerializer.First方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCurrentReleaseFromFile

        public static AggregateView GetCurrentReleaseFromFile()
        {
            var import = new Import();
            if (File.Exists(HttpContext.Current.Server.MapPath(import.YouTrackJsonFile)) == false)
                import.SaveAllToFile();

            var allText = File.ReadAllText(HttpContext.Current.Server.MapPath(import.YouTrackJsonFile));

            var data = new JavaScriptSerializer().Deserialize<List<AggregateView>>(allText);
            var result = data.First(x => x.currentRelease);

            return result;
        }
开发者ID:Aaen,项目名称:OurUmbraco,代码行数:13,代码来源:Download.cs

示例2: PostCreditApplication

        public void PostCreditApplication()
        {
            var userName = "user";
            var password = "1234567";
            var tokenResponse = HttpClient.PostAsync("/token",
                new FormUrlEncodedContent(new []
                {
                    new KeyValuePair<string, string>("grant_type", "password"),
                    new KeyValuePair<string, string>("username", userName),
                    new KeyValuePair<string, string>("password", password)
                })).Result;
            var tokenBodyValues = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(tokenResponse.Content.ReadAsStringAsync().Result);

            var creditTypeResponse = HttpClient.GetAsync("/api/creditTypes").Result;
            var creditTypes = new JavaScriptSerializer().Deserialize<List<CreditTypeModel>>(creditTypeResponse.Content.ReadAsStringAsync().Result);
            var creditApplication = new CreditApplication()
            {
                DesiredAmount = 100000,
                DesiredTerm = 12,
                CreditAim = "sdfsdfsd",

                AptNumber = 2,
                CorpusNumber = 2,
                HomeNumber = 2,
                Locality = "Минская Область",
                Street = "Богдановича",

                MaritalStatus = "холост",
                EducationLevel = "незаконченное высшее",
                NumberOfFamilyMembers = 5,
                NumberOfDependents = 0,

                BirthDate = new DateTime(1993, 12, 8),
                DateOfIssue = DateTime.Now,
                PassportNumber = "MP1231724",
                PersonalNumber = "3081293A005PB9",
                PlaceOfBirth = "Минск, Беларусь",
                PlaceOfIssue = "Фрунзенское РУВД г.Минска",

                FirstName = "Максим",
                LastName = "Рахлеев",
                MiddleName = "Александрович",
                MobilePhone = "375295053587",
                Email = "[email protected]",

                CompanyName = "ФордэКонсалтинг",
                Position = ".Net Developer",
                Activity = "sdfsdf",
                DateOfBeginning = new DateTime(2015, 4, 23),
                Profit = 200000000,

                Status = CreditApplicationStatus.InQueue,
                DeclineReason = String.Empty,
                ClientId = tokenBodyValues["user_id"],
                CreditTypeId = creditTypes.First().Id
            };
            var stringContent = new JavaScriptSerializer().Serialize(creditApplication);
            var creditApplicationResponse = HttpClient.PostAsync("/api/creditApplications",
                new StringContent(new JavaScriptSerializer().Serialize(creditApplication), Encoding.Unicode, "application/json")).Result;
            var creditApplicationBodyValues = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(creditApplicationResponse.Content.ReadAsStringAsync().Result);
            Assert.That(creditApplicationBodyValues.ContainsKey("id"));
        }
开发者ID:iemee,项目名称:AlphaBank,代码行数:62,代码来源:CreditApplicationControllerTests.cs


注:本文中的System.Web.Script.Serialization.JavaScriptSerializer.First方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。