mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-10-04 07:09:58 +00:00
31 lines
No EOL
952 B
C#
31 lines
No EOL
952 B
C#
using LBPUnion.ProjectLighthouse.Database;
|
|
using LBPUnion.ProjectLighthouse.Types.Entities.Website;
|
|
using LBPUnion.ProjectLighthouse.Types.Serialization.News;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers;
|
|
|
|
[ApiController]
|
|
[Authorize]
|
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
|
[Produces("text/xml")]
|
|
public class NewsController : ControllerBase
|
|
{
|
|
private readonly DatabaseContext database;
|
|
|
|
public NewsController(DatabaseContext database)
|
|
{
|
|
this.database = database;
|
|
}
|
|
|
|
[HttpGet("news")]
|
|
public async Task<IActionResult> GetNews()
|
|
{
|
|
List<WebsiteAnnouncementEntity> websiteAnnouncements =
|
|
await this.database.WebsiteAnnouncements.OrderByDescending(a => a.AnnouncementId).ToListAsync();
|
|
|
|
return this.Ok(GameNews.CreateFromEntity(websiteAnnouncements));
|
|
}
|
|
} |