Created
May 6, 2013 03:12
-
-
Save yesez/5523173 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//IPaisRepository | |
public interface IPaisRepository | |
{ | |
IEnumerable<Pais> GetAll(); | |
} | |
//PaisRepository | |
public class PaisRepository:IPaisRepository | |
{ | |
private readonly IEnumerable<Pais> paises = new List<Pais>() | |
{ | |
new Pais() { Id = 1, Nombre = "Nicaragua" }, | |
new Pais() { Id = 2, Nombre = "Colombia" }, | |
new Pais() { Id = 3, Nombre = "España" }, | |
new Pais() { Id = 4, Nombre = "Francia" }, | |
new Pais() { Id = 5, Nombre = "Portugal" } | |
}; | |
public IEnumerable<Pais> GetAll() | |
{ | |
return paises.AsQueryable(); | |
} | |
} | |
//PaisesSinDiController | |
public class PaisesSinDiController : ApiController | |
{ | |
private readonly IPaisRepository repositorio = new PaisRepository(); | |
public IEnumerable<Pais> Get() | |
{ | |
return repositorio.GetAll(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment