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.Entity;
|
2018-10-06 13:05:38 +02:00
|
|
|
|
using LaDOSE.Entity.Context;
|
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]")]
|
2018-10-06 02:05:00 +02:00
|
|
|
|
[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]
|
2018-10-06 02:05:00 +02:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
}
|