Skip to content

AvinashChavanN/algorithms-data-structures-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Web; using System.Web.Mvc; using WebApplication1.Models;

namespace WebApplication1.Controllers { public class HomeController : Controller { public ActionResult Index() { using (var webClient = new WebClient()) { // String represen String rawJSON = webClient.DownloadString("https://jsonplaceholder.typicode.com/posts"); List userCollection = JsonConvert.DeserializeObject<List>(rawJSON); Console.WriteLine(userCollection); } return View(); }

    [HttpGet]
    public ActionResult getData(int email)
    {
        List<Uer> userCollection = new List<Uer>();
        using (var webClient = new WebClient())
        {
            // String represen
            String rawJSON = webClient.DownloadString("https://jsonplaceholder.typicode.com/posts?id="+email);
            userCollection = JsonConvert.DeserializeObject<List<Uer>>(rawJSON);
            Console.WriteLine(userCollection);
        }
        return Json(userCollection,JsonRequestBehavior.AllowGet);
    }

    public ActionResult About()
    {
        ViewBag.Message = "Your application description page.";

        return View();
    }

    public ActionResult Contact()
    {
        ViewBag.Message = "Your contact page.";

        return View();
    }

}

}

using System; using System.Collections.Generic; using System.Linq; using System.Web;

namespace WebApplication1.Models { public class Uer { int userId; int id; string title; string body;

    public string Body { get => body; set => body = value; }
    public int UserId { get => userId; set => userId = value; }
    public int Id { get => id; set => id = value; }
    public string Title { get => title; set => title = value; }
}

}

About

Algorithms and Data Structure problems in JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published