Created NavData Model

Create Navdata Model and add Navata controller (Currently empty)
This commit is contained in:
Luke Else 2022-01-26 13:11:04 +00:00
parent 87a5dbfafa
commit b68cc2ac3f
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace EFB.Controllers
{
//[Route("[controller]")]
public class NavdataController : Controller
{
private readonly ILogger<NavdataController> _logger;
public NavdataController(ILogger<NavdataController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View("Error!");
}
}
}

View File

@ -4,5 +4,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/> <PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
<PackageReference Include="MySql.Data" Version="*"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

45
Models/NavdataModel.cs Normal file
View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
namespace EFB.Models
{
public class NavdataModel
{
public int Id { get; set; }
public string Name { get; set; }
public int? Frequency { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public NavdataModel(int id, string name, string latitude, string longitude){
Id = id;
Name = name;
Frequency = null;
Latitude = latitude;
Longitude = longitude;
}
public NavdataModel(int id, string name, int frequency, string latitude, string longitude){
Id = id;
Name = name;
Frequency = frequency;
Latitude = latitude;
Longitude = longitude;
}
public NavdataModel[] Populate(){
MySqlConnection db = new MySqlConnection("root:XXXXXXX@XXX.XXX.XXX.XXX:3306/EFB");
}
}
}