git_bsmd/AIS/bsmd.AIS2Service/webservice/SLRController.cs

28 lines
955 B
C#

using System.Collections.Generic;
using System.Web.Http;
namespace bsmd.AIS2Service
{
public class SLRController : ApiController
{
[HttpGet]
public IEnumerable<ShipLocationReport> Get([FromUri] int? id)
{
if (!id.HasValue) return null;
List<ShipLocationReport> result = AISManager.SQLiteStorage.GetShipLocationReports(id.Value);
foreach(ShipLocationReport report in result) {
if (AISManager.SitRep.ContainsKey(report.MMSI))
{
report.Destination = AISManager.SitRep[report.MMSI].Destination;
report.Name = AISManager.SitRep[report.MMSI].Name;
report.NavStatus = AIS_PosReport.GetNavStatus(AISManager.SitRep[report.MMSI].NavStatus);
report.IMO = AISManager.SitRep[report.MMSI].IMO;
}
}
return result;
}
}
}