Files
LaDOSE/LaDOSE.Src/LaDOSE.Api/Controllers/GameController.cs

43 lines
872 B
C#
Raw Normal View History

2018-10-04 21:13:32 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
2018-10-05 00:18:37 +02:00
using LaDOSE.Api.Context;
using LaDOSE.Entity;
2018-10-05 01:51:23 +02:00
using Microsoft.AspNetCore.Authorization;
2018-10-04 21:13:32 +02:00
using Microsoft.AspNetCore.Mvc;
namespace LaDOSE.Api.Controllers
{
2018-10-05 01:51:23 +02:00
[Authorize]
2018-10-04 21:13:32 +02:00
[Route("api/[controller]")]
[Produces("application/json")]
2018-10-05 01:51:23 +02:00
public class GameController : ControllerBase
2018-10-04 21:13:32 +02:00
{
2018-10-05 00:18:37 +02:00
private readonly LaDOSEDbContext _db;
2018-10-05 01:51:23 +02:00
public GameController(LaDOSEDbContext db)
2018-10-05 00:18:37 +02:00
{
_db = db;
}
2018-10-04 21:13:32 +02:00
// GET api/Config
[HttpGet]
public List<Game> Get()
2018-10-04 21:13:32 +02:00
{
2018-10-05 00:18:37 +02:00
return _db.Game.ToList();
2018-10-04 21:13:32 +02:00
}
2018-10-05 01:51:23 +02:00
2018-10-04 21:13:32 +02:00
// GET api/Config/5
[HttpGet("{id}")]
2018-10-05 01:51:23 +02:00
public Game Get(int id)
2018-10-04 21:13:32 +02:00
{
2018-10-05 01:51:23 +02:00
return _db.Game.FirstOrDefault(e=>e.Id==id);
2018-10-04 21:13:32 +02:00
}
2018-10-05 01:51:23 +02:00
2018-10-04 21:13:32 +02:00
}
}