45 lines
2.8 KiB
C#
45 lines
2.8 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Reflection.Metadata;
|
|
using TIAM.Database.DbContexts;
|
|
using TIAM.Entities.TransferDestinations;
|
|
using TIAMWebApp.Shared.Application.Models;
|
|
|
|
namespace TIAMWebApp.Server.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("[controller]")]
|
|
public class TransferDataAPIController : ControllerBase
|
|
{
|
|
//private static readonly TransferDestination[] Names = new TransferDestination[]
|
|
//{
|
|
// /*"Castle of Buda", "Hungarian National Museum", "Parliament of Hungary", "Heroes square", "Gellert Hill", "Margaret Island"*/
|
|
// new() { DestinationId = 1, DestinationName = "Airport", DestinationDescription = "International airport of Budapest", DestinationLatitude = 42.234444f, DestinationLongitude = 39.100010f },
|
|
// new() { DestinationId = 2, DestinationName = "Castle of Buda", DestinationDescription = "International airport of Budapest", DestinationLatitude = 42.234444f, DestinationLongitude = 39.100010f },
|
|
// new() { DestinationId = 3, DestinationName = "Hungarian National Museum", DestinationDescription = "International airport of Budapest", DestinationLatitude = 42.234444f, DestinationLongitude = 39.100010f },
|
|
// new() { DestinationId = 4, DestinationName = "Parliament of Hungary", DestinationDescription = "International airport of Budapest", DestinationLatitude = 42.234444f, DestinationLongitude = 39.100010f },
|
|
// new() { DestinationId = 5, DestinationName = "Heroes square", DestinationDescription = "International airport of Budapest", DestinationLatitude = 42.234444f, DestinationLongitude = 39.100010f },
|
|
// new() { DestinationId = 6, DestinationName = "Gellert Hill", DestinationDescription = "International airport of Budapest", DestinationLatitude = 42.234444f, DestinationLongitude = 39.100010f },
|
|
// new() { DestinationId = 6, DestinationName = "Margaret Island", DestinationDescription = "International airport of Budapest", DestinationLatitude = 42.234444f, DestinationLongitude = 39.100010f }
|
|
|
|
//};
|
|
|
|
private readonly TransferDestinationDbContext _transferDestinationDbContext;
|
|
private readonly ILogger<TransferDataAPIController> _logger;
|
|
|
|
public TransferDataAPIController(ILogger<TransferDataAPIController> logger, TransferDestinationDbContext transferDestinationDbContext)
|
|
{
|
|
_logger = logger;
|
|
_transferDestinationDbContext = transferDestinationDbContext;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<IEnumerable<TransferDestination>> Get()
|
|
{
|
|
//return new JsonResult(await _transferDestinationDbContext.TransferDestinations.ToListAsync());
|
|
|
|
var result = await _transferDestinationDbContext.TransferDestinations.ToListAsync();
|
|
return result;
|
|
}
|
|
}
|
|
} |