Skip to content

Instantly share code, notes, and snippets.

@azaharafernandezguizan
Created December 30, 2018 17:15
Show Gist options
  • Save azaharafernandezguizan/c29695e47b7a4873c5d84768d7873666 to your computer and use it in GitHub Desktop.
Save azaharafernandezguizan/c29695e47b7a4873c5d84768d7873666 to your computer and use it in GitHub Desktop.
Example of Web API Controller on NetCore
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MyDTOs;
using MyManager;
using Microsoft.AspNetCore.Mvc;
namespace MyApp.Controllers
{
[Route("api/[controller]")]
public class InfoController : Controller
{
public IInfoManager infoManager = new InfoManager();
[HttpGet]
public String GetDefault()
{
return "Bienvenido a la WebAPI de ejemplo";
}
[HttpGet("getRecursos", Name = "GetRecursos")]
public List<RecursosInfo> GetRecursos()
{
return infoManager.getRecursos();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment