Add API to get most recent reading

This commit is contained in:
2019-08-07 18:39:59 -04:00
parent ef073a500b
commit f4da45f4bb
6 changed files with 89 additions and 48 deletions

View File

@@ -0,0 +1,25 @@
using ChrisKaczor.HomeMonitor.Weather.Models;
using ChrisKaczor.HomeMonitor.Weather.Service.Data;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace ChrisKaczor.HomeMonitor.Weather.Service.Controllers
{
[Route("[controller]")]
[ApiController]
public class ReadingsController : ControllerBase
{
private readonly Database _database;
public ReadingsController(Database database)
{
_database = database;
}
[HttpGet("recent")]
public async Task<ActionResult<WeatherReading>> GetRecent()
{
return await _database.GetRecentReading();
}
}
}