Skip to content

Instantly share code, notes, and snippets.

View renatocantarino's full-sized avatar

Renato Cantarino renatocantarino

View GitHub Profile
@model IEnumerable<OpenMVC.Models.AcidentesDeTrabalho>
@{
ViewBag.Title = "Index";
}
<table>
<tr class="editor-label">
public ActionResult Index()
{
var retornoOpenData = Helpers.Builder.Download_And_Serialize_Data<RootObject>("http://api.dataprev.gov.br/previdencia/anuario/2009/acidentes-do-trabalho.json");
var lista = retornoOpenData.acidentes_de_trabalho.Take(15);
return View(lista);
}
using System;
using System.Net;
namespace OpenMVC.Helpers
{
public class Builder
{
public static T Download_And_Serialize_Data<T>(string url) where T : new()
{
using (var w = new WebClient())
public class AcidentesComCat
{
public int trajeto { get; set; }
public int doenca { get; set; }
public int tipicos { get; set; }
}
public class Quantidade
{
public AcidentesComCat acidentes_com_cat { get; set; }
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
public class Program {
/**
* @param args
* @throws IOException
using System.Web.Script.Serialization;
namespace cliente.Helper
{
public static class Json
{
public static string ToJSON(this object obj)
{
var _serializador = new JavaScriptSerializer();
return _serializador.Serialize(obj);
using cliente.Helper;
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
namespace cliente
{
internal class Program
namespace cliente
{
public class Pessoa
{
public string Age { get; set; }
public string Name { get; set; }
}
}
@renatocantarino
renatocantarino / web
Created June 19, 2013 14:40
WebConfig
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
</serviceHostingEnvironment>
@renatocantarino
renatocantarino / global
Created June 19, 2013 14:37
Global.asx
using System;
using System.ServiceModel.Activation;
using System.Web.Routing;
namespace appRest
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{