using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Threading.Tasks;
using RestSharp.Authenticators;
namespace CloudTableApi.Controllers
[Route("api/[controller]")]
public class TestsController : ControllerBase
public Info GetAllPosts()
var client = new RestClient("https://jsonplaceholder.typicode.com/");
var request = new RestRequest("comments", DataFormat.Json);
var response = client.Get(request);
List<Comment> m = JsonConvert.DeserializeObject<List<Comment>>(response.Content);
[HttpGet("SimpleGetAllPostsByPagenumber")]
public List<Comment> SimpleGetAllPostsByPagenumber(int pagenumber)
var clientAllData = new RestClient("https://jsonplaceholder.typicode.com/");
var requestAllData = new RestRequest("comments", DataFormat.Json);
var responseAllData = clientAllData.Get(requestAllData);
List<Comment> datawithpagenumberAllData = JsonConvert.DeserializeObject<List<Comment>>(responseAllData.Content);
var client = new RestClient("https://jsonplaceholder.typicode.com/");
var request = new RestRequest("comments?postId=" + pagenumber.ToString(), DataFormat.Json);
var response = client.Get(request);
List<Comment> datawithpagenumber = JsonConvert.DeserializeObject<List<Comment>>(response.Content);
return datawithpagenumber;
[HttpGet("GetAllPostsByPagenumber")]
public Info GetAllPostsByPagenumber(int pagenumber)
var clientAllData = new RestClient("https://jsonplaceholder.typicode.com/");
var requestAllData = new RestRequest("comments", DataFormat.Json);
var responseAllData = clientAllData.Get(requestAllData);
List<Comment> datawithpagenumberAllData = JsonConvert.DeserializeObject<List<Comment>>(responseAllData.Content);
var client = new RestClient("https://jsonplaceholder.typicode.com/");
var request = new RestRequest("comments?postId=" + pagenumber.ToString(), DataFormat.Json);
var response = client.Get(request);
List<Comment> datawithpagenumber = JsonConvert.DeserializeObject<List<Comment>>(response.Content);
info.Data = datawithpagenumber;
info.TotalRecords = datawithpagenumberAllData.Count();
info.TotalDisplayRecords = datawithpagenumber.Count();
public int TotalRecords { get; set; }
public int TotalDisplayRecords { get; set; }
public List<Comment> Data { get; set; }
public int PostId { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string Body { get; set; }