public async Task <IActionResult> Signup(string username, string password, string email, string name, string lastname, string image, string cover, bool isFacebook) { var model = new EscolaDeVoce.Services.ViewModel.CreateUserViewModel(); model.password = password; model.username = email; model.person = new EscolaDeVoce.Services.ViewModel.PersonViewModel(); model.person.name = name; model.person.lastname = lastname; model.image = image; model.cover = cover; Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.UserViewModel> createuserresponse = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; createuserresponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.UserViewModel> >( Helpers.EscolaDeVoceEndpoints.User.create, method, JsonConvert.SerializeObject(model) ); if (createuserresponse != null) { return(await this.Login(username, password, isFacebook)); } return(Json(new { status = false })); }
public async Task <IActionResult> SaveComment(string id, string comment) { var model = new EscolaDeVoce.Services.ViewModel.CommentEscoleteTalkViewModel(); model.Id = Guid.Parse(id); model.comment = comment; model.userId = Guid.Parse(getClaimValue("Id")); Infrastructure.ApiResponse <bool> commentresponse = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; commentresponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <bool> >( Helpers.EscolaDeVoceEndpoints.EscoleTalk.comment, method, JsonConvert.SerializeObject(model) ); if (commentresponse != null) { return(Json(new { success = true })); } return(Json(new { success = false })); // return View(); }
} // End Sub MultipleDataSets public static void PostJSON(string url, System.Net.Http.HttpMethod method, object obj) { if (obj == null || obj == System.DBNull.Value) { throw new System.ArgumentNullException("obj"); } // url = "http://localhost:53417/ajax/dataReceiver.ashx"; Newtonsoft.Json.JsonSerializer sr = new Newtonsoft.Json.JsonSerializer(); using (System.Net.WebClient client = new System.Net.WebClient()) { client.Headers.Add("Content-Type", "application/json"); using (System.IO.Stream postStream = client.OpenWrite(url, method.Method)) { sr.Formatting = Newtonsoft.Json.Formatting.Indented; sr.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat; // sr.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Unspecified; using (System.IO.TextWriter tw = new System.IO.StreamWriter(postStream, System.Text.Encoding.UTF8)) { sr.Serialize(tw, obj); } // End Using tw } // End Using postStream } // End Using client } // End Sub PostJSON
public async Task <IActionResult> AddToFavorite(string videoId) { var model = new EscolaDeVoce.Services.ViewModel.AddVideoToFavoriteViewModel(); model.userId = Guid.Parse(getClaimValue("Id")); model.videoId = Guid.Parse(videoId); Infrastructure.ApiResponse <bool> favoriteresponse = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; favoriteresponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <bool> >( Helpers.EscolaDeVoceEndpoints.Videos.addToFavorites, method, JsonConvert.SerializeObject(model) ); if (favoriteresponse != null) { return(Json(new { success = true })); } return(Json(new { success = false })); }
/// <summary> /// Tests whether the action attributes restrict the request to a specific HTTP method /// (<see cref="AcceptVerbsAttribute"/> or the specific /// <see cref="HttpGetAttribute"/>, <see cref="HttpPostAttribute"/>, etc.). /// </summary> /// <param name="actionAttributesTestBuilder"> /// Instance of <see cref="IActionAttributesTestBuilder"/> type. /// </param> /// <param name="httpMethod">HTTP method provided as <see cref="System.Net.Http.HttpMethod"/> class.</param> /// <returns>The same <see cref="IAndActionAttributesTestBuilder"/>.</returns> public static IAndActionAttributesTestBuilder RestrictingForHttpMethod( this IActionAttributesTestBuilder actionAttributesTestBuilder, SystemHttpMethod httpMethod) => actionAttributesTestBuilder .RestrictingForHttpMethods(new List <SystemHttpMethod> { httpMethod });
public async Task <IActionResult> AnswerQuestion(string answerId, int score) { var model = new EscolaDeVoce.Services.ViewModel.UserAnswerQuestionViewModel(); model.userId = Guid.Parse(getClaimValue("Id")); model.answearId = Guid.Parse(answerId); model.score = score; Infrastructure.ApiResponse <bool> mensagemresponse = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; mensagemresponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <bool> >( Helpers.EscolaDeVoceEndpoints.User.answerQuestion, method, JsonConvert.SerializeObject(model) ); if (mensagemresponse != null) { return(Json(new { success = true })); } return(Json(new { success = false })); }
public void OAuthClient_MakeRequest_HasAccesstoken() { // arrange var resourcePath = new Uri(TU.GenerateLocalHostBaseAddress()); var systemNetHttpMethod = new System.Net.Http.HttpMethod("GET"); var webRequestResult = HttpWebRequest.CreateDefault(resourcePath); string resourceResult = TU.RandomAlphaNumString(); var tokenInfo = new TokenInfo { AccessToken = TU.RandomAlphaNumString(), AccessTokenSecret = TU.RandomAlphaNumString() }; A.CallTo(() => tokenService.GetAccessToken(A<string>._, out tokenInfo)) .Returns(true); A.CallTo(() => clientConsumer.MakeHttpRequest(A<Uri>._,A<HttpMethod>._)) .Returns(webRequestResult); A.CallTo(() => httpRequestReader.ReadHttpRequest(A<WebRequest>._)) .Returns(resourceResult); // act client.Login("email"); var actualResult = client.Request(resourcePath, systemNetHttpMethod); // assert Assert.AreEqual(actualResult, resourceResult); TU.MustHaveHappend(() => clientConsumer.MakeHttpRequest( TU.Matches(resourcePath), TU.Matches(systemNetHttpMethod.Convert()) )); TU.MustHaveHappend(() => httpRequestReader.ReadHttpRequest( TU.Matches(webRequestResult) )); }
private void PerformUpdateTest(Dictionary <string, string> request, System.Net.Http.HttpMethod method) { var userHandler = new UserManager(); var result = userHandler.Execute <ErrorResponse>(request, method); PrAssert.That(result, PrIs.ErrorResponse().And.HttpCode((int)System.Net.HttpStatusCode.BadRequest)); }
public async Task <IActionResult> Detail([Bind("Id,name")] Services.ViewModel.CategoryViewModel model) { Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.CategoryViewModel> response = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; var url = Helpers.EscolaDeVoceEndpoints.Category.getCategories; if (model.Id != Guid.Empty) { method = System.Net.Http.HttpMethod.Put; url = Helpers.EscolaDeVoceEndpoints.Category.getCategories + "/" + model.Id.ToString(); } response = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.CategoryViewModel> >( url, method, JsonConvert.SerializeObject(model) ); if (model.Id != Guid.Empty || (response.data != null && response.data.Id != Guid.Empty)) { var Id = model.Id != Guid.Empty ? model.Id : response.data.Id; return(RedirectToAction("Detail", new { id = Id.ToString() })); } return(RedirectToAction("Index")); }
/// <summary> /// Perform an HTTP GET request to a URL using an HTTP Authorization header /// </summary> /// <param name="url">The URL</param> /// <param name="token">The token</param> /// <returns>String containing the results of the GET operation</returns> public static async Task <System.Net.Http.HttpResponseMessage> PatchHttpContentWithToken(string url, Microsoft.Graph.AutomaticRepliesSetting OOF) { OOFSponderInsights.TrackInfo(OOFSponderInsights.CurrentMethod()); //check and refresh token if necessary await O365.MSALWork(O365.AADAction.SignIn); var httpClient = new System.Net.Http.HttpClient(); System.Net.Http.HttpMethod method = new System.Net.Http.HttpMethod("PATCH"); System.Net.Http.HttpResponseMessage response; // var response = client.PostAsync("api/AgentCollection", new StringContent( //new JavaScriptSerializer().Serialize(user), Encoding.UTF8, "application/json")).Result; try { Microsoft.Graph.MailboxSettings mbox = new Microsoft.Graph.MailboxSettings(); mbox.AutomaticRepliesSetting = OOF; var request = new System.Net.Http.HttpRequestMessage(method, UrlCombine(_graphAPIEndpoint, url)); var jsonBody = Newtonsoft.Json.JsonConvert.SerializeObject(mbox); System.Net.Http.StringContent iContent = new System.Net.Http.StringContent(jsonBody, Encoding.UTF8, "application/json"); request.Content = iContent; //Add the token in Authorization header request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", authResult.AccessToken); response = await httpClient.SendAsync(request); return(response); } catch (Exception ex) { throw new Exception("Unable to set OOF: " + ex.Message, ex); } }
public async Task <IActionResult> sendMessage(string message, string to) { var model = new EscolaDeVoce.Services.ViewModel.MessageViewModel(); model.fromId = Guid.Parse(getClaimValue("Id")); model.message = message; model.toId = Guid.Parse(to); model.title = message; Infrastructure.ApiResponse <bool> mensagemresponse = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; mensagemresponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <bool> >( Helpers.EscolaDeVoceEndpoints.Message.get, method, JsonConvert.SerializeObject(model) ); if (mensagemresponse != null) { return(Json(new { success = true })); } return(Json(new { success = false })); // return View(); }
/// <summary> /// Request the HTTP with the given parameters. /// </summary> /// <typeparam name="TResponse">The response type we expect.</typeparam> /// <param name="httpRequestMethod">HTTP request method.</param> /// <param name="restUrlExtension">The URL extension to the base URL.</param> /// <param name="jsonParam">Json parameter to attach to the HTTP body.</param> /// <param name="bIsPeek">Flag to indicate looking at the first few characters for the response.</param> /// <returns>The response type we expect.</returns> private TResponse HttpRequest_ <TResponse>( System.Net.Http.HttpMethod httpRequestMethod, string restUrlExtension, string jsonParam) where TResponse : class { TResponse httpReponse = null; try { System.Net.HttpWebRequest httpRequest = CreateWebRequest_(httpRequestMethod, restUrlExtension); WriteParamToWebRequest_(httpRequest, jsonParam); System.Net.HttpWebResponse httpResponse = (System.Net.HttpWebResponse)httpRequest.GetResponse(); httpReponse = HandleHttpReponse_ <TResponse>(httpResponse); } catch (System.Net.WebException webEx) { } return(httpReponse); }
public void WhenMethodIsOneOfThoseWithBody_ReturnsTrue(string method) { var sut = new System.Net.Http.HttpMethod(method); var actual = sut.SupportsBody(); actual.Should().BeTrue(); }
private Uri ExtractHttpRouteInternal <T>(HttpMethod httpMethod, T payload, Type routeType) { var routeTemplatesAndTokens = routeType .GetFields() .Where(f => f.GetCustomAttributes(typeof(HttpRouteTemplateAttribute)).Any()) .Select(f => (string)f.GetValue(payload)) .ToDictionary(routeTemplate => routeTemplate, routeTemplate => { var matches = TokensRegex.Matches(routeTemplate); var results = matches.OfType <Match>().Select(m => m.Value.Trim("{}".ToCharArray())).ToArray(); return(results); }) .OrderByDescending(kvp => kvp.Value.Length) .ToArray(); foreach (var kvp in routeTemplatesAndTokens) { var routeTemplate = kvp.Key; var routePlaceholderTokens = kvp.Value; if (TryReplaceAllRouteTokens(httpMethod, routeTemplate, routePlaceholderTokens, payload, out var route)) { return(new Uri(route, UriKind.Relative)); } } throw new PayloadRoutingException("Unable to resolve route template."); }
public override Task <string> GetResponseString <HttpListenerRequest> (System.Net.Http.HttpMethod method, HttpListenerRequest request, System.Collections.Specialized.NameValueCollection queryString, string data) { var deviceId = queryString ["DeviceId"]; var server = (request as System.Net.HttpListenerRequest).Url.Host; var resp = MessageTemplates.GetSetupTemplate(server, AmazonEchoWebServer.EchoWebServerPort, EchoDiscoveryService.GetDeviceId()); return(Task.FromResult(resp)); }
public HttpMethod(System.Net.Http.HttpMethod containedObject) { if ((containedObject == null)) { throw new System.ArgumentNullException("containedObject"); } this.containedObject = containedObject; }
public static HttpResult Request(string url, System.Net.Http.HttpMethod method, Encoding encoding) { return(Request(new HttpRequest { Url = url, Method = method.ToString(), Encoding = encoding })); }
public async Task <IActionResult> startCourse(string courseId) { Infrastructure.ApiResponse <bool> courseResponse = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; courseResponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <bool> >( Helpers.EscolaDeVoceEndpoints.User.startCourse + "/" + getClaimValue("Id") + "/" + courseId, method ); return(Json(new { success = true })); }
internal void Navigate( Uri requestUri, System.Net.Http.HttpMethod method, string content = null, IEnumerable <KeyValuePair <string, string> > headers = null) { if (requestUri == null) { throw new ArgumentNullException(nameof(requestUri)); } if (method == null) { throw new ArgumentNullException(nameof(method)); } // Convert a System.Net.Http.HttpMethod to Windows.Web.Http.HttpMethod HttpMethod ToHttpMethod(System.Net.Http.HttpMethod httpMethod) { if (System.Net.Http.HttpMethod.Get.Equals(httpMethod)) { return(HttpMethod.Get); } if (System.Net.Http.HttpMethod.Post.Equals(httpMethod)) { return(HttpMethod.Post); } // For compatabilty with WebView.NavigateWithHttpRequestMessage, this only supports POST and GET throw new ArgumentOutOfRangeException(nameof(httpMethod)); } var requestMessage = new HttpRequestMessage { RequestUri = requestUri, Method = ToHttpMethod(method) }; if (content != null) { requestMessage.Content = new HttpStringContent(content); } if (headers != null) { foreach (var header in headers) { requestMessage.Headers.Add(header); } } NavigateWithHttpRequestMessage(requestMessage); }
public async Task <IActionResult> UpdateAccount([Bind("Id,name,lastname,cpf,haveBusiness,children,genre,birthday,phonenumber,email,addressTitle,addressStreet,addressPostalcode,addressCity,addressState,addressNumber,addressNeighborhood")] Services.ViewModel.PersonViewModel model) { Infrastructure.ApiResponse <bool> favoriteresponse = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Put; favoriteresponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <bool> >( Helpers.EscolaDeVoceEndpoints.Person.get + "/" + model.Id, method, JsonConvert.SerializeObject(model) ); return(Json(new {})); }
public async Task <IActionResult> Delete(Guid id) { Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.CourseViewModel> response = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Delete; response = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.CourseViewModel> >( Helpers.EscolaDeVoceEndpoints.Courses.getCourses + "/" + id.ToString(), method ); return(RedirectToAction("Index")); }
public async Task <IActionResult> consultaCep(string cep) { // Frontend.Address addressresponse = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Put; addressresponse = await ApiRequestHelper.Get <Frontend.Address>( "https://viacep.com.br/ws/" + cep + "/json/", null ); return(Json(addressresponse)); }
public async Task <IActionResult> updateVideoStatus([Bind("progress,videoId")] Services.ViewModel.UpdateVideoStatusViewModel model) { Infrastructure.ApiResponse <bool> favoriteresponse = null; model.userId = Guid.Parse(getClaimValue("Id")); System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; favoriteresponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <bool> >( Helpers.EscolaDeVoceEndpoints.Videos.updateStatus, method, JsonConvert.SerializeObject(model) ); return(View()); }
public async Task <IActionResult> AddDictionaryItem([Bind("title,content,dictionaryType")] Services.ViewModel.DictionaryViewModel model) { Infrastructure.ApiResponse <bool> favoriteresponse = null; model.userId = Guid.Parse(getClaimValue("Id")); System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; favoriteresponse = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <bool> >( Helpers.EscolaDeVoceEndpoints.Dictionary.get, method, JsonConvert.SerializeObject(model) ); return(View()); }
public static HttpMethod ToTweetinviHttpMethod(this System.Net.Http.HttpMethod method) { switch (method.Method) { case "GET": return(HttpMethod.GET); case "POST": return(HttpMethod.POST); } throw new InvalidCastException("Cannot convert http method"); }
/// <summary> /// Creates and returns the web request. /// </summary> /// <param name="httpRequestMethod">The HTTP request method.</param> /// <param name="restUrlExtension">The extension to append to the base URL.</param> /// <returns>HTTP web request.</returns> private System.Net.HttpWebRequest CreateWebRequest_( System.Net.Http.HttpMethod httpRequestMethod, string restUrlExtension) { System.Net.HttpWebRequest httpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(m_baseUrl + restUrlExtension); httpWebRequest.ContentType = "application/json; charset=utf-8"; httpWebRequest.Method = httpRequestMethod.Method; // allows for validation of SSL conversations System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; return(httpWebRequest); }
public async Task <IActionResult> Login([Bind("username,password")] Services.ViewModel.UserViewModel model) { Console.Write(model); AuthenticationModel response = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; if (model.Id != Guid.Empty) { method = System.Net.Http.HttpMethod.Put; } response = await ApiRequestHelper.postPutEncodedRequest <AuthenticationModel>( EscolaDeVoce.Backend.Helpers.EscolaDeVoceEndpoints.tokenUrl, model.username, model.password ); if (response != null) { const string Issuer = "https://www.escoladevoce.com.br"; var claims = new List <Claim> { new Claim(ClaimTypes.Name, "Charles", ClaimValueTypes.String, Issuer), new Claim(ClaimTypes.Surname, "França", ClaimValueTypes.String, Issuer), new Claim(ClaimTypes.Country, "BR", ClaimValueTypes.String, Issuer), new Claim(ClaimTypes.Country, "BR", ClaimValueTypes.String, Issuer), new Claim("TOKEN", response.access_token, ClaimValueTypes.String, Issuer), new Claim("facebookid", "112345432145432", ClaimValueTypes.String, Issuer), new Claim("id", Guid.NewGuid().ToString(), ClaimValueTypes.String) }; var userIdentity = new ClaimsIdentity(claims, "Passport"); var userPrincipal = new ClaimsPrincipal(userIdentity); await HttpContext.Authentication.SignInAsync("Cookie", userPrincipal, new AuthenticationProperties { ExpiresUtc = DateTime.UtcNow.AddMinutes(20), IsPersistent = true, AllowRefresh = false }); return(RedirectToAction("Index", "Project")); } Console.Write(response); return(View()); }
public async Task <IActionResult> Detail([Bind("Id,name,image,free,description,duration,schoolId,categoriesId,views,order")] Services.ViewModel.CourseViewModel model, ICollection <IFormFile> files) { var uploads = Path.Combine(_environment.WebRootPath, "images/specialists"); if (files != null) { foreach (var file in files) { if (file.Length > 0) { var fileextension = Path.GetExtension(file.FileName); var filename = Guid.NewGuid().ToString() + fileextension; model.image = filename; using (var fileStream = new FileStream(Path.Combine(uploads, filename), FileMode.Create)) { await file.CopyToAsync(fileStream); } } } } Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.CourseViewModel> response = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; string url = Helpers.EscolaDeVoceEndpoints.Courses.getCourses; if (model.Id != Guid.Empty) { method = System.Net.Http.HttpMethod.Put; url += "/" + model.Id.ToString(); } response = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.CourseViewModel> >( url, method, JsonConvert.SerializeObject(model) ); if (model.Id != Guid.Empty || (response.data != null && response.data.Id != Guid.Empty)) { var Id = model.Id != Guid.Empty ? model.Id : response.data.Id; return(RedirectToAction("Detail", new { id = Id.ToString() })); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Detail([Bind("Id,name")] Services.ViewModel.ProjectViewModel model) { Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.ProjectViewModel> response = null; System.Net.Http.HttpMethod method = System.Net.Http.HttpMethod.Post; if (model.Id != Guid.Empty) { method = System.Net.Http.HttpMethod.Put; } response = await ApiRequestHelper.postPutRequest <Infrastructure.ApiResponse <EscolaDeVoce.Services.ViewModel.ProjectViewModel> >( Helpers.EscolaDeVoceEndpoints.Project.getProjects + "/" + model.Id.ToString(), method, JsonConvert.SerializeObject(model) ); return(View(response.data)); }
private bool TryReplaceAllRouteTokens(HttpMethod httpMethod, string routeTemplate, string[] tokens, object payload, out string route) { var payloadProperties = PayloadProperties(payload); route = routeTemplate; foreach (var token in tokens) { var payloadProperty = payloadProperties .Where(kvp => kvp.Key.Equals(token, StringComparison.InvariantCultureIgnoreCase)) .SingleOrDefault(); var key = payloadProperty.Key; var value = payloadProperty.Value; if (value is null) { return(false); } route = route.Replace($"{{{token}}}", WebUtility.UrlEncode(value.ToString())); payloadProperties.Remove(key); } // If we're routing a GET request, every property not added to the route gets added as a query string // parameter - otherwise it can just go as a JSON payload. if (httpMethod == HttpMethod.Get) { var queryString = payloadProperties .OrderBy(kvp => kvp.Key) .Select(kvp => $"{kvp.Key.ToCamelCase()}={WebUtility.UrlEncode(kvp.Value.ToString())}") .StringJoin("&"); if (!string.IsNullOrEmpty(queryString)) { route += $"?{queryString}"; } } return(true); }
public async Task <SearchStudentsRS> ListStudentsByPageAsync(string pageUrl) { GraphServiceClient graphClient = GetGraphServiceClient(new[] { Constants.ScopeUserReadBasicAll }); await graphClient.Users.Request().Top(1).GetAsync(); //gets the authenthication token (to do: find better way) var httpRqMethod_GET = new System.Net.Http.HttpMethod("GET"); var nextPageHttpRq = new System.Net.Http.HttpRequestMessage(httpRqMethod_GET, pageUrl); var nextPageHttpRs = await graphClient.HttpProvider.SendAsync(nextPageHttpRq); var responseJSON = await nextPageHttpRs.Content.ReadAsStringAsync(); #region MapJsonToResult var responseJObject = JObject.Parse(responseJSON); var nextPageURL = responseJObject["@odata.nextLink"]?.ToString(); var currentPageJSON = responseJObject["value"]?.ToString() ?? string.Empty; var currentPageData = JsonConvert.DeserializeObject <IList <Graph.User> >(currentPageJSON); var studentDTOs = currentPageData?.Select(s => new AzureUserDTO(s)); #endregion return(new SearchStudentsRS(studentDTOs, nextPageURL)); }