26 lines
620 B
C#
26 lines
620 B
C#
using GerbilManager.Models;
|
|
using GerbilManager.Repositories;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace GerbilManager.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("gerbils")]
|
|
public class GerbilsController : ControllerBase
|
|
{
|
|
private readonly InMemGerbilRepository repository;
|
|
|
|
public GerbilsController()
|
|
{
|
|
repository = new InMemGerbilRepository();
|
|
}
|
|
|
|
//GET /gerbils
|
|
[HttpGet]
|
|
public IEnumerable<Gerbil> GetGerbils()
|
|
{
|
|
var items = repository.GetGerbils();
|
|
return items;
|
|
}
|
|
}
|
|
} |