Auth
This commit is contained in:
42
LaDOSE.Src/LaDOSE.Api/Controllers/GameController.cs
Normal file
42
LaDOSE.Src/LaDOSE.Api/Controllers/GameController.cs
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user