This commit is contained in:
2018-10-05 01:51:23 +02:00
parent d2c1a9d5f9
commit 335c496133
6 changed files with 343 additions and 6 deletions

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using LaDOSE.Api.Context;
using LaDOSE.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace LaDOSE.Api.Controllers
{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class GameController : ControllerBase
{
private readonly LaDOSEDbContext _db;
public GameController(LaDOSEDbContext db)
{
_db = db;
}
// GET api/Config
[HttpGet]
public ActionResult<IEnumerable<Game>> Get()
{
return _db.Game.ToList();
}
// GET api/Config/5
[HttpGet("{id}")]
public Game Get(int id)
{
return _db.Game.FirstOrDefault(e=>e.Id==id);
}
}
}