diff --git a/RaceLapTimer/Interfaces/CompetitionRace.cs b/RaceLapTimer/Interfaces/CompetitionRace.cs new file mode 100644 index 0000000..511a50b --- /dev/null +++ b/RaceLapTimer/Interfaces/CompetitionRace.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Interfaces +{ + public class CompetitionRace + { + public List Pilots { get; set; } + public string Title { get; set; } + public int MaxLaps { get; set; } + public int NumberOfSatellites { get; set; } + public int SatelliteTimePenaltyMicroS { get; set; } + public bool HotSeatEnabled { get; set; } + public int IdleTime { get; set; } + } +} \ No newline at end of file diff --git a/RaceLapTimer/Interfaces/ConfigurationSetting.cs b/RaceLapTimer/Interfaces/ConfigurationSetting.cs new file mode 100644 index 0000000..751074c --- /dev/null +++ b/RaceLapTimer/Interfaces/ConfigurationSetting.cs @@ -0,0 +1,13 @@ +using System; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Interfaces +{ + public class ConfigurationSetting + { + public string ConfigurationName { get; set; } + public string ConfigurationValue { get; set; } + } +} diff --git a/RaceLapTimer/Interfaces/Interfaces.csproj b/RaceLapTimer/Interfaces/Interfaces.csproj index 678e359..1b7e18a 100644 --- a/RaceLapTimer/Interfaces/Interfaces.csproj +++ b/RaceLapTimer/Interfaces/Interfaces.csproj @@ -40,8 +40,13 @@ + + + + + diff --git a/RaceLapTimer/Interfaces/Pilot.cs b/RaceLapTimer/Interfaces/Pilot.cs new file mode 100644 index 0000000..9a092a5 --- /dev/null +++ b/RaceLapTimer/Interfaces/Pilot.cs @@ -0,0 +1,10 @@ +namespace Interfaces +{ + public class Pilot + { + public string Name { get; set; } + public int TransponderToken { get; set; } + public string ThingyName { get; set; } + public string TeamName { get; set; } + } +} \ No newline at end of file diff --git a/RaceLapTimer/Interfaces/RaceMode.cs b/RaceLapTimer/Interfaces/RaceMode.cs new file mode 100644 index 0000000..d63c60b --- /dev/null +++ b/RaceLapTimer/Interfaces/RaceMode.cs @@ -0,0 +1,8 @@ +namespace Interfaces +{ + public enum RaceMode + { + STANDARD = 1, + COMPETITION = 2 + } +} \ No newline at end of file diff --git a/RaceLapTimer/Interfaces/RaceSession.cs b/RaceLapTimer/Interfaces/RaceSession.cs new file mode 100644 index 0000000..dd320f0 --- /dev/null +++ b/RaceLapTimer/Interfaces/RaceSession.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Interfaces +{ + public class RaceSession + { + public int Id { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } + public string Title { get; set; } + public bool Active { get; set; } + public RaceMode Mode { get; set; } + public int MaxLaps { get; set; } + public DateTime DeletedAt { get; set; } + public int SatelliteCount { get; set; } + public int TimePenaltyPerSatellite { get; set; } + public bool HotSeatEnabled { get; set; } + public int IdleTimeSeconds { get; set; } + } +} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/InfoApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/InfoApiModule.cs new file mode 100644 index 0000000..73cc6af --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/InfoApiModule.cs @@ -0,0 +1,12 @@ +using Nancy; + +namespace RaceLapTimer.ApiControllers +{ + public class InfoApiModule:NancyModule + { + public InfoApiModule() : base("/api/info") + { + + } + } +} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/InfoController.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/InfoController.cs deleted file mode 100644 index 3ee0012..0000000 --- a/RaceLapTimer/RaceLapTimer/ApiControllers/InfoController.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Web.Http; - -namespace RaceLapTimer -{ - public class InfoController:ApiController - { - /// - /// returns the last transponder Id from the ir daemon. - /// - /// - [HttpGet] - public IHttpActionResult LastScannedId() - { - throw new NotImplementedException(); - } - } -} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/LapTrackApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/LapTrackApiModule.cs new file mode 100644 index 0000000..dc55c35 --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/LapTrackApiModule.cs @@ -0,0 +1,12 @@ +using Nancy; + +namespace RaceLapTimer.ApiControllers +{ + public class LapTrackApiModule:NancyModule + { + public LapTrackApiModule() : base("/api/laptrack") + { + + } + } +} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/LapTrackController.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/LapTrackController.cs deleted file mode 100644 index fbb070a..0000000 --- a/RaceLapTimer/RaceLapTimer/ApiControllers/LapTrackController.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Web.Http; - -namespace RaceLapTimer -{ - public class LapTrackController:ApiController - { - } -} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/MonitorApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/MonitorApiModule.cs new file mode 100644 index 0000000..08bbddd --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/MonitorApiModule.cs @@ -0,0 +1,12 @@ +using Nancy; + +namespace RaceLapTimer.ApiControllers +{ + public class MonitorApiModule:NancyModule + { + public MonitorApiModule() : base("api/monitor") + { + + } + } +} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/MonitorController.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/MonitorController.cs deleted file mode 100644 index 1f351a3..0000000 --- a/RaceLapTimer/RaceLapTimer/ApiControllers/MonitorController.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Web.Http; - -namespace RaceLapTimer -{ - public class MonitorController:ApiController - { - } -} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/PilotApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/PilotApiModule.cs new file mode 100644 index 0000000..8601923 --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/PilotApiModule.cs @@ -0,0 +1,13 @@ +using System.Web.Http; +using Nancy; + +namespace RaceLapTimer.ApiControllers +{ + public class PilotApiModule:NancyModule + { + public PilotApiModule() : base("/api/pilot") + { + + } + } +} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/PilotController.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/PilotController.cs deleted file mode 100644 index adeb572..0000000 --- a/RaceLapTimer/RaceLapTimer/ApiControllers/PilotController.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Web.Http; - -namespace RaceLapTimer -{ - public class PilotController:ApiController - { - } -} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/RaceSessionApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/RaceSessionApiModule.cs new file mode 100644 index 0000000..05e11a7 --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/RaceSessionApiModule.cs @@ -0,0 +1,20 @@ +using Interfaces; +using Nancy; +using Nancy.ModelBinding; + +namespace RaceLapTimer.ApiControllers +{ + public class RaceSessionApiModule:NancyModule + { + public RaceSessionApiModule() : base("/api/racesession") + { + Post["/create"] = args => CreateRaceSession(args); + } + + private dynamic CreateRaceSession(dynamic args) + { + var postObject = this.Bind(); + return Response.AsRedirect("/racedirector"); + } + } +} \ No newline at end of file diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/RaceSessionController.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/RaceSessionController.cs deleted file mode 100644 index 38bd82f..0000000 --- a/RaceLapTimer/RaceLapTimer/ApiControllers/RaceSessionController.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Web.Http; - -namespace RaceLapTimer -{ - public class RaceSessionController:ApiController - { - - } -} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/SatelliteApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/SatelliteApiModule.cs new file mode 100644 index 0000000..0a0c65d --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/SatelliteApiModule.cs @@ -0,0 +1,12 @@ +using Nancy; + +namespace RaceLapTimer.ApiControllers +{ + public class SatelliteApiModule:NancyModule + { + public SatelliteApiModule() : base("/api/satellite") + { + + } + } +} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/SatelliteController.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/SatelliteController.cs deleted file mode 100644 index 0781ac3..0000000 --- a/RaceLapTimer/RaceLapTimer/ApiControllers/SatelliteController.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace RaceLapTimer -{ - public class SatelliteController - { - } -} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/SoundApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/SoundApiModule.cs new file mode 100644 index 0000000..e179ea7 --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/SoundApiModule.cs @@ -0,0 +1,13 @@ +using System.Web.Http; +using Nancy; + +namespace RaceLapTimer.ApiControllers +{ + public class SoundApiModule:NancyModule + { + public SoundApiModule() : base("/api/sound") + { + + } + } +} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/SoundController.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/SoundController.cs deleted file mode 100644 index 985ae4a..0000000 --- a/RaceLapTimer/RaceLapTimer/ApiControllers/SoundController.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Web.Http; - -namespace RaceLapTimer -{ - public class SoundController:ApiController - { - } -} diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/SystemApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/SystemApiModule.cs new file mode 100644 index 0000000..8c65d33 --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/SystemApiModule.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Nancy; + +namespace RaceLapTimer.ApiControllers +{ + public class SystemApiModule:NancyModule + { + public SystemApiModule() : base("/api/system") + { + + } + } +} diff --git a/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj b/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj index 1e2ab71..1704b25 100644 --- a/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj +++ b/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj @@ -98,20 +98,21 @@ - - - - - - - + + + + + + + + diff --git a/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj.DotSettings b/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj.DotSettings index 23810ed..8fa21a3 100644 --- a/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj.DotSettings +++ b/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj.DotSettings @@ -1,2 +1,2 @@  - True \ No newline at end of file + False \ No newline at end of file diff --git a/RaceLapTimer/RaceLapTimer/Startup.cs b/RaceLapTimer/RaceLapTimer/Startup.cs index c55d846..d8a3ef5 100644 --- a/RaceLapTimer/RaceLapTimer/Startup.cs +++ b/RaceLapTimer/RaceLapTimer/Startup.cs @@ -13,12 +13,12 @@ namespace RaceLapTimer config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; config.Routes.MapHttpRoute( name: "DefaultApi", - routeTemplate: "api/{controller}/{id}", + routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); config.EnsureInitialized(); - app.UseWebApi(config); + //app.UseWebApi(config); app.UseNancy(); } diff --git a/RaceLapTimer/RaceLapTimer/www/Views/login.cshtml b/RaceLapTimer/RaceLapTimer/www/Views/login.cshtml index 14003fa..ff7c089 100644 --- a/RaceLapTimer/RaceLapTimer/www/Views/login.cshtml +++ b/RaceLapTimer/RaceLapTimer/www/Views/login.cshtml @@ -2,24 +2,16 @@ @{ Layout = "razor-layout.cshtml"; } - - - - Login - - -
- Username -
- Password -
- Remember Me -
- -
- @if (Model.Errored) - { -
Invalid Username or Password
- } - - \ No newline at end of file +
+ Username +
+ Password +
+ Remember Me +
+ +
+@if (Model.Errored) +{ +
Invalid Username or Password
+} \ No newline at end of file diff --git a/RaceLapTimer/RaceLapTimer/www/Views/razor-layout.cshtml b/RaceLapTimer/RaceLapTimer/www/Views/razor-layout.cshtml index 3065e89..d46f145 100644 --- a/RaceLapTimer/RaceLapTimer/www/Views/razor-layout.cshtml +++ b/RaceLapTimer/RaceLapTimer/www/Views/razor-layout.cshtml @@ -26,7 +26,7 @@