diff --git a/bahnplan.web/Controllers/TestController.cs b/bahnplan.web/Controllers/TestController.cs index 940618d..fc7d27f 100644 --- a/bahnplan.web/Controllers/TestController.cs +++ b/bahnplan.web/Controllers/TestController.cs @@ -1,29 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Threading.Tasks; +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; namespace bahnplan.web.Controllers { - [ApiController] - [Route("api/[controller]")] + [ApiController, Route("api/[controller]")] public class TestController : ControllerBase { [HttpGet] - public ApiResponse Get() { - return new ApiResponse("test", 4); - } + public ApiResponse Get() => new ApiResponse("test", 4); } [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] public class ApiResponse { - public string String1 { get; } - public int Int1 { get; } - public ApiResponse(string string1, int int1) { String1 = string1; - Int1 = int1; + Int1 = int1; } + + public string String1 { get; } + public int Int1 { get; } } } \ No newline at end of file diff --git a/bahnplan.web/JSON/CardResponse/CardResponse.cs b/bahnplan.web/JSON/CardResponse/CardResponse.cs index 5cd31d8..f643940 100644 --- a/bahnplan.web/JSON/CardResponse/CardResponse.cs +++ b/bahnplan.web/JSON/CardResponse/CardResponse.cs @@ -11,136 +11,204 @@ using System.Globalization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace bahnplan.web.JSON.CardResponse -{ - public partial class CardResponse - { - [JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)] public Xml Xml { get; set; } - [JsonProperty("rporderdetails", NullValueHandling = NullValueHandling.Ignore)] public Rporderdetails Rporderdetails { get; set; } - } +namespace bahnplan.web.JSON.CardResponse { + public partial class CardResponse { + [JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)] + public Xml Xml { get; set; } - public class Rporderdetails - { - [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] public string Version { get; set; } - [JsonProperty("rpheader", NullValueHandling = NullValueHandling.Ignore)] public Rpheader Rpheader { get; set; } - [JsonProperty("order", NullValueHandling = NullValueHandling.Ignore)] public Order Order { get; set; } - } + [JsonProperty("rporderdetails", NullValueHandling = NullValueHandling.Ignore)] + public Rporderdetails Rporderdetails { get; set; } + } - public class Order - { - [JsonProperty("@cdt", NullValueHandling = NullValueHandling.Ignore)] public string Cdt { get; set; } - [JsonProperty("@cid", NullValueHandling = NullValueHandling.Ignore)] public string Cid { get; set; } - [JsonProperty("@ddt", NullValueHandling = NullValueHandling.Ignore)] public string Ddt { get; set; } - [JsonProperty("@fkat", NullValueHandling = NullValueHandling.Ignore)] public string Fkat { get; set; } - [JsonProperty("@ldt", NullValueHandling = NullValueHandling.Ignore)] public string Ldt { get; set; } - [JsonProperty("@on", NullValueHandling = NullValueHandling.Ignore)] public string On { get; set; } - [JsonProperty("@pg", NullValueHandling = NullValueHandling.Ignore)] public string Pg { get; set; } - [JsonProperty("@sdt", NullValueHandling = NullValueHandling.Ignore)] public string Sdt { get; set; } - [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] public string Version { get; set; } - [JsonProperty("@vfrom", NullValueHandling = NullValueHandling.Ignore)] public string Vfrom { get; set; } - [JsonProperty("@vto", NullValueHandling = NullValueHandling.Ignore)] public string Vto { get; set; } - [JsonProperty("@zweg", NullValueHandling = NullValueHandling.Ignore)] public string Zweg { get; set; } - [JsonProperty("tcklist", NullValueHandling = NullValueHandling.Ignore)] public Tcklist Tcklist { get; set; } - [JsonProperty("posinfolist", NullValueHandling = NullValueHandling.Ignore)] public Posinfolist Posinfolist { get; set; } - } + public class Rporderdetails { + [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] + public string Version { get; set; } - public class Posinfolist - { - [JsonProperty("posinfo", NullValueHandling = NullValueHandling.Ignore)] public Posinfo Posinfo { get; set; } - } + [JsonProperty("rpheader", NullValueHandling = NullValueHandling.Ignore)] + public Rpheader Rpheader { get; set; } - public class Posinfo - { - [JsonProperty("@dir", NullValueHandling = NullValueHandling.Ignore)] public string Dir { get; set; } - [JsonProperty("@dirlabel", NullValueHandling = NullValueHandling.Ignore)] public string Dirlabel { get; set; } - [JsonProperty("@posnr", NullValueHandling = NullValueHandling.Ignore)] public string Posnr { get; set; } - [JsonProperty("@shownr", NullValueHandling = NullValueHandling.Ignore)] public string Shownr { get; set; } - [JsonProperty("@state", NullValueHandling = NullValueHandling.Ignore)] public string State { get; set; } - [JsonProperty("@type", NullValueHandling = NullValueHandling.Ignore)] public string Type { get; set; } - [JsonProperty("@typeinfo", NullValueHandling = NullValueHandling.Ignore)] public string Typeinfo { get; set; } - [JsonProperty("@vfo", NullValueHandling = NullValueHandling.Ignore)] public string Vfo { get; set; } - [JsonProperty("@vto", NullValueHandling = NullValueHandling.Ignore)] public string Vto { get; set; } - [JsonProperty("childlist")] public object Childlist { get; set; } - } + [JsonProperty("order", NullValueHandling = NullValueHandling.Ignore)] + public Order Order { get; set; } + } - public class Tcklist - { - [JsonProperty("tck", NullValueHandling = NullValueHandling.Ignore)] public Tck Tck { get; set; } - } + public class Order { + [JsonProperty("@cdt", NullValueHandling = NullValueHandling.Ignore)] + public string Cdt { get; set; } - public class Tck - { - [JsonProperty("@posnr", NullValueHandling = NullValueHandling.Ignore)] public string Posnr { get; set; } - [JsonProperty("htdata", NullValueHandling = NullValueHandling.Ignore)] public Htdata Htdata { get; set; } - [JsonProperty("mtk", NullValueHandling = NullValueHandling.Ignore)] public Mtk Mtk { get; set; } - [JsonProperty("bahncardimage", NullValueHandling = NullValueHandling.Ignore)] public Bahncardimage Bahncardimage { get; set; } - } + [JsonProperty("@cid", NullValueHandling = NullValueHandling.Ignore)] + public string Cid { get; set; } - public class Bahncardimage - { - [JsonProperty("#cdata-section", NullValueHandling = NullValueHandling.Ignore)] public string CdataSection { get; set; } - } + [JsonProperty("@ddt", NullValueHandling = NullValueHandling.Ignore)] + public string Ddt { get; set; } - public class Htdata - { - [JsonProperty("ht", NullValueHandling = NullValueHandling.Ignore)] public List Ht { get; set; } - } + [JsonProperty("@fkat", NullValueHandling = NullValueHandling.Ignore)] + public string Fkat { get; set; } - public class Ht - { - [JsonProperty("@name", NullValueHandling = NullValueHandling.Ignore)] public string Name { get; set; } - [JsonProperty("@pos", NullValueHandling = NullValueHandling.Ignore)] public string Pos { get; set; } - [JsonProperty("@type", NullValueHandling = NullValueHandling.Ignore)] public string Type { get; set; } - [JsonProperty("#text", NullValueHandling = NullValueHandling.Ignore)] public string Text { get; set; } - } + [JsonProperty("@ldt", NullValueHandling = NullValueHandling.Ignore)] + public string Ldt { get; set; } - public class Mtk - { - [JsonProperty("@dir", NullValueHandling = NullValueHandling.Ignore)] public string Dir { get; set; } - [JsonProperty("@status", NullValueHandling = NullValueHandling.Ignore)] public string Status { get; set; } - [JsonProperty("txt", NullValueHandling = NullValueHandling.Ignore)] public string Txt { get; set; } - [JsonProperty("zb", NullValueHandling = NullValueHandling.Ignore)] public string Zb { get; set; } - [JsonProperty("nvplist", NullValueHandling = NullValueHandling.Ignore)] public Nvplist Nvplist { get; set; } - } + [JsonProperty("@on", NullValueHandling = NullValueHandling.Ignore)] + public string On { get; set; } - public class Nvplist - { - [JsonProperty("nvp", NullValueHandling = NullValueHandling.Ignore)] public List Nvp { get; set; } - } + [JsonProperty("@pg", NullValueHandling = NullValueHandling.Ignore)] + public string Pg { get; set; } - public class Nvp - { - [JsonProperty("@name", NullValueHandling = NullValueHandling.Ignore)] public string Name { get; set; } - [JsonProperty("#text", NullValueHandling = NullValueHandling.Ignore)] public string Text { get; set; } - } + [JsonProperty("@sdt", NullValueHandling = NullValueHandling.Ignore)] + public string Sdt { get; set; } - public class Rpheader - { - [JsonProperty("@tnr", NullValueHandling = NullValueHandling.Ignore)] public string Tnr { get; set; } - [JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)] public string Ts { get; set; } - } + [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] + public string Version { get; set; } - public class Xml - { - [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] public string Version { get; set; } - [JsonProperty("@encoding", NullValueHandling = NullValueHandling.Ignore)] public string Encoding { get; set; } - } + [JsonProperty("@vfrom", NullValueHandling = NullValueHandling.Ignore)] + public string Vfrom { get; set; } - public partial class CardResponse - { - public static CardResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Converter.Settings); - } + [JsonProperty("@vto", NullValueHandling = NullValueHandling.Ignore)] + public string Vto { get; set; } - internal static class Converter - { - public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings - { - MetadataPropertyHandling = MetadataPropertyHandling.Ignore, - DateParseHandling = DateParseHandling.None, - Converters = - { - new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } - }, - }; - } -} + [JsonProperty("@zweg", NullValueHandling = NullValueHandling.Ignore)] + public string Zweg { get; set; } + + [JsonProperty("tcklist", NullValueHandling = NullValueHandling.Ignore)] + public Tcklist Tcklist { get; set; } + + [JsonProperty("posinfolist", NullValueHandling = NullValueHandling.Ignore)] + public Posinfolist Posinfolist { get; set; } + } + + public class Posinfolist { + [JsonProperty("posinfo", NullValueHandling = NullValueHandling.Ignore)] + public Posinfo Posinfo { get; set; } + } + + public class Posinfo { + [JsonProperty("@dir", NullValueHandling = NullValueHandling.Ignore)] + public string Dir { get; set; } + + [JsonProperty("@dirlabel", NullValueHandling = NullValueHandling.Ignore)] + public string Dirlabel { get; set; } + + [JsonProperty("@posnr", NullValueHandling = NullValueHandling.Ignore)] + public string Posnr { get; set; } + + [JsonProperty("@shownr", NullValueHandling = NullValueHandling.Ignore)] + public string Shownr { get; set; } + + [JsonProperty("@state", NullValueHandling = NullValueHandling.Ignore)] + public string State { get; set; } + + [JsonProperty("@type", NullValueHandling = NullValueHandling.Ignore)] + public string Type { get; set; } + + [JsonProperty("@typeinfo", NullValueHandling = NullValueHandling.Ignore)] + public string Typeinfo { get; set; } + + [JsonProperty("@vfo", NullValueHandling = NullValueHandling.Ignore)] + public string Vfo { get; set; } + + [JsonProperty("@vto", NullValueHandling = NullValueHandling.Ignore)] + public string Vto { get; set; } + + [JsonProperty("childlist")] public object Childlist { get; set; } + } + + public class Tcklist { + [JsonProperty("tck", NullValueHandling = NullValueHandling.Ignore)] + public Tck Tck { get; set; } + } + + public class Tck { + [JsonProperty("@posnr", NullValueHandling = NullValueHandling.Ignore)] + public string Posnr { get; set; } + + [JsonProperty("htdata", NullValueHandling = NullValueHandling.Ignore)] + public Htdata Htdata { get; set; } + + [JsonProperty("mtk", NullValueHandling = NullValueHandling.Ignore)] + public Mtk Mtk { get; set; } + + [JsonProperty("bahncardimage", NullValueHandling = NullValueHandling.Ignore)] + public Bahncardimage Bahncardimage { get; set; } + } + + public class Bahncardimage { + [JsonProperty("#cdata-section", NullValueHandling = NullValueHandling.Ignore)] + public string CdataSection { get; set; } + } + + public class Htdata { + [JsonProperty("ht", NullValueHandling = NullValueHandling.Ignore)] + public List Ht { get; set; } + } + + public class Ht { + [JsonProperty("@name", NullValueHandling = NullValueHandling.Ignore)] + public string Name { get; set; } + + [JsonProperty("@pos", NullValueHandling = NullValueHandling.Ignore)] + public string Pos { get; set; } + + [JsonProperty("@type", NullValueHandling = NullValueHandling.Ignore)] + public string Type { get; set; } + + [JsonProperty("#text", NullValueHandling = NullValueHandling.Ignore)] + public string Text { get; set; } + } + + public class Mtk { + [JsonProperty("@dir", NullValueHandling = NullValueHandling.Ignore)] + public string Dir { get; set; } + + [JsonProperty("@status", NullValueHandling = NullValueHandling.Ignore)] + public string Status { get; set; } + + [JsonProperty("txt", NullValueHandling = NullValueHandling.Ignore)] + public string Txt { get; set; } + + [JsonProperty("zb", NullValueHandling = NullValueHandling.Ignore)] + public string Zb { get; set; } + + [JsonProperty("nvplist", NullValueHandling = NullValueHandling.Ignore)] + public Nvplist Nvplist { get; set; } + } + + public class Nvplist { + [JsonProperty("nvp", NullValueHandling = NullValueHandling.Ignore)] + public List Nvp { get; set; } + } + + public class Nvp { + [JsonProperty("@name", NullValueHandling = NullValueHandling.Ignore)] + public string Name { get; set; } + + [JsonProperty("#text", NullValueHandling = NullValueHandling.Ignore)] + public string Text { get; set; } + } + + public class Rpheader { + [JsonProperty("@tnr", NullValueHandling = NullValueHandling.Ignore)] + public string Tnr { get; set; } + + [JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)] + public string Ts { get; set; } + } + + public class Xml { + [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] + public string Version { get; set; } + + [JsonProperty("@encoding", NullValueHandling = NullValueHandling.Ignore)] + public string Encoding { get; set; } + } + + public partial class CardResponse { + public static CardResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Converter.Settings); + } + + internal static class Converter { + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings { + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, + DateParseHandling = DateParseHandling.None, + Converters = {new IsoDateTimeConverter {DateTimeStyles = DateTimeStyles.AssumeUniversal}} + }; + } +} \ No newline at end of file diff --git a/bahnplan.web/JSON/ListOrdersResponse/ListOrdersResponse.cs b/bahnplan.web/JSON/ListOrdersResponse/ListOrdersResponse.cs index ee64773..6d829e7 100644 --- a/bahnplan.web/JSON/ListOrdersResponse/ListOrdersResponse.cs +++ b/bahnplan.web/JSON/ListOrdersResponse/ListOrdersResponse.cs @@ -9,53 +9,67 @@ using System.Collections.Generic; using Newtonsoft.Json; -namespace bahnplan.web.JSON.ListOrdersResponse -{ - public partial class ListOrdersResponse - { - [JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)] public Xml Xml { get; set; } - [JsonProperty("rporderheadlist", NullValueHandling = NullValueHandling.Ignore)] public Rporderheadlist Rporderheadlist { get; set; } - } +namespace bahnplan.web.JSON.ListOrdersResponse { + public partial class ListOrdersResponse { + [JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)] + public Xml Xml { get; set; } - public class Rporderheadlist - { - [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] public string Version { get; set; } - [JsonProperty("rpheader", NullValueHandling = NullValueHandling.Ignore)] public Rpheader Rpheader { get; set; } - [JsonProperty("orderheadlist", NullValueHandling = NullValueHandling.Ignore)] public Orderheadlist Orderheadlist { get; set; } - } + [JsonProperty("rporderheadlist", NullValueHandling = NullValueHandling.Ignore)] + public Rporderheadlist Rporderheadlist { get; set; } + } - public class Orderheadlist - { - [JsonProperty("orderhead", NullValueHandling = NullValueHandling.Ignore)] public List Orderhead { get; set; } - } + public class Rporderheadlist { + [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] + public string Version { get; set; } - public class Orderhead - { - [JsonProperty("@ldt", NullValueHandling = NullValueHandling.Ignore)] public string Ldt { get; set; } - [JsonProperty("@on", NullValueHandling = NullValueHandling.Ignore)] public string On { get; set; } - [JsonProperty("authtmp", NullValueHandling = NullValueHandling.Ignore)] public Authtmp Authtmp { get; set; } - } + [JsonProperty("rpheader", NullValueHandling = NullValueHandling.Ignore)] + public Rpheader Rpheader { get; set; } - public class Authtmp - { - [JsonProperty("@htmp", NullValueHandling = NullValueHandling.Ignore)] public string Htmp { get; set; } - [JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)] public string Ts { get; set; } - } + [JsonProperty("orderheadlist", NullValueHandling = NullValueHandling.Ignore)] + public Orderheadlist Orderheadlist { get; set; } + } - public class Rpheader - { - [JsonProperty("@tnr", NullValueHandling = NullValueHandling.Ignore)] public string Tnr { get; set; } - [JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)] public string Ts { get; set; } - } + public class Orderheadlist { + [JsonProperty("orderhead", NullValueHandling = NullValueHandling.Ignore)] + public List Orderhead { get; set; } + } - public class Xml - { - [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] public string Version { get; set; } - [JsonProperty("@encoding", NullValueHandling = NullValueHandling.Ignore)] public string Encoding { get; set; } - } + public class Orderhead { + [JsonProperty("@ldt", NullValueHandling = NullValueHandling.Ignore)] + public string Ldt { get; set; } - public partial class ListOrdersResponse - { - public static ListOrdersResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Converter.Settings); - } -} + [JsonProperty("@on", NullValueHandling = NullValueHandling.Ignore)] + public string On { get; set; } + + [JsonProperty("authtmp", NullValueHandling = NullValueHandling.Ignore)] + public Authtmp Authtmp { get; set; } + } + + public class Authtmp { + [JsonProperty("@htmp", NullValueHandling = NullValueHandling.Ignore)] + public string Htmp { get; set; } + + [JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)] + public string Ts { get; set; } + } + + public class Rpheader { + [JsonProperty("@tnr", NullValueHandling = NullValueHandling.Ignore)] + public string Tnr { get; set; } + + [JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)] + public string Ts { get; set; } + } + + public class Xml { + [JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)] + public string Version { get; set; } + + [JsonProperty("@encoding", NullValueHandling = NullValueHandling.Ignore)] + public string Encoding { get; set; } + } + + public partial class ListOrdersResponse { + public static ListOrdersResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Converter.Settings); + } +} \ No newline at end of file diff --git a/bahnplan.web/JSON/OEAPIResponse.cs b/bahnplan.web/JSON/OEAPIResponse.cs index 14cf3b4..d74f8eb 100644 --- a/bahnplan.web/JSON/OEAPIResponse.cs +++ b/bahnplan.web/JSON/OEAPIResponse.cs @@ -9,151 +9,254 @@ using System.Collections.Generic; using Newtonsoft.Json; -namespace bahnplan.web.JSON -{ - using J = JsonPropertyAttribute; - using R = Required; - using N = NullValueHandling; +namespace bahnplan.web.JSON { + using J = JsonPropertyAttribute; + using R = Required; + using N = NullValueHandling; - public partial class OeapiResponse - { - [J("status", NullValueHandling = N.Ignore)] public string Status { get; set; } - [J("msg", NullValueHandling = N.Ignore)] public string Msg { get; set; } - [J("data", NullValueHandling = N.Ignore)] public Data Data { get; set; } - } + public partial class OeapiResponse { + [J("status", NullValueHandling = N.Ignore)] + public string Status { get; set; } - public class Data - { - [J("reqId", NullValueHandling = N.Ignore)] public string ReqId { get; set; } - [J("lastUpdated", NullValueHandling = N.Ignore)] public long? LastUpdated { get; set; } - [J("params", NullValueHandling = N.Ignore)] public Params Params { get; set; } - [J("journeys", NullValueHandling = N.Ignore)] public Dictionary Journeys { get; set; } - } + [J("msg", NullValueHandling = N.Ignore)] + public string Msg { get; set; } - public class OJourney - { - [J("lastUpdated", NullValueHandling = N.Ignore)] public long? LastUpdated { get; set; } - [J("legs", NullValueHandling = N.Ignore)] public List Legs { get; set; } - [J("price")] public object Price { get; set; } - } + [J("data", NullValueHandling = N.Ignore)] + public Data Data { get; set; } + } - public class Leg - { - [J("isWalking", NullValueHandling = N.Ignore)] public bool? IsWalking { get; set; } - [J("isTransfer", NullValueHandling = N.Ignore)] public bool? IsTransfer { get; set; } - [J("cancelled", NullValueHandling = N.Ignore)] public bool? Cancelled { get; set; } - [J("departure", NullValueHandling = N.Ignore)] public Arrival Departure { get; set; } - [J("arrival", NullValueHandling = N.Ignore)] public Arrival Arrival { get; set; } - [J("polyline")] public object Polyline { get; set; } - [J("distance")] public object Distance { get; set; } - [J("line", NullValueHandling = N.Ignore)] public Line Line { get; set; } - [J("direction", NullValueHandling = N.Ignore)] public string Direction { get; set; } - [J("stopovers", NullValueHandling = N.Ignore)] public List Stopovers { get; set; } - [J("remarks", NullValueHandling = N.Ignore)] public List Remarks { get; set; } - } + public class Data { + [J("reqId", NullValueHandling = N.Ignore)] + public string ReqId { get; set; } - public class Arrival - { - [J("point", NullValueHandling = N.Ignore)] public Point Point { get; set; } - [J("plannedTime")] public long? PlannedTime { get; set; } - [J("prognosedTime")] public long? PrognosedTime { get; set; } - [J("plannedPlatform")] public string PlannedPlatform { get; set; } - [J("prognosedPlatform")] public object PrognosedPlatform { get; set; } - } + [J("lastUpdated", NullValueHandling = N.Ignore)] + public long? LastUpdated { get; set; } - public class Point - { - [J("stop", NullValueHandling = N.Ignore)] public Stop Stop { get; set; } - [J("location")] public object Location { get; set; } - } + [J("params", NullValueHandling = N.Ignore)] + public Params Params { get; set; } - public class Stop - { - [J("id", NullValueHandling = N.Ignore)] public string Id { get; set; } - [J("name", NullValueHandling = N.Ignore)] public string Name { get; set; } - [J("location", NullValueHandling = N.Ignore)] public Location Location { get; set; } - [J("products", NullValueHandling = N.Ignore)] public Products Products { get; set; } - [J("station")] public object Station { get; set; } - } + [J("journeys", NullValueHandling = N.Ignore)] + public Dictionary Journeys { get; set; } + } - public class Location - { - [J("latitude", NullValueHandling = N.Ignore)] public double? Latitude { get; set; } - [J("longitude", NullValueHandling = N.Ignore)] public double? Longitude { get; set; } - [J("name")] public object Name { get; set; } - [J("address")] public object Address { get; set; } - [J("id")] public object Id { get; set; } - } + public class OJourney { + [J("lastUpdated", NullValueHandling = N.Ignore)] + public long? LastUpdated { get; set; } - public class Products - { - [J("nationalExp", NullValueHandling = N.Ignore)] public bool? NationalExp { get; set; } - [J("national", NullValueHandling = N.Ignore)] public bool? National { get; set; } - [J("regionalExp", NullValueHandling = N.Ignore)] public bool? RegionalExp { get; set; } - [J("regional", NullValueHandling = N.Ignore)] public bool? Regional { get; set; } - [J("suburban", NullValueHandling = N.Ignore)] public bool? Suburban { get; set; } - [J("bus", NullValueHandling = N.Ignore)] public bool? Bus { get; set; } - [J("ferry", NullValueHandling = N.Ignore)] public bool? Ferry { get; set; } - [J("subway", NullValueHandling = N.Ignore)] public bool? Subway { get; set; } - [J("tram", NullValueHandling = N.Ignore)] public bool? Tram { get; set; } - [J("taxi", NullValueHandling = N.Ignore)] public bool? Taxi { get; set; } - } + [J("legs", NullValueHandling = N.Ignore)] + public List Legs { get; set; } - public class Line - { - [J("id", NullValueHandling = N.Ignore)] public string Id { get; set; } - [J("name", NullValueHandling = N.Ignore)] public string Name { get; set; } - [J("mode", NullValueHandling = N.Ignore)] public string Mode { get; set; } - [J("product", NullValueHandling = N.Ignore)] public string Product { get; set; } - [J("tripNum", NullValueHandling = N.Ignore)] public string TripNum { get; set; } - [J("productName", NullValueHandling = N.Ignore)] public string ProductName { get; set; } - [J("fullProductName", NullValueHandling = N.Ignore)] public string FullProductName { get; set; } - [J("operator")] public object Operator { get; set; } - [J("additionalName")] public string AdditionalName { get; set; } - } + [J("price")] public object Price { get; set; } + } - public class Remark - { - [J("type", NullValueHandling = N.Ignore)] public string Type { get; set; } - [J("code", NullValueHandling = N.Ignore)] public string Code { get; set; } - [J("summary")] public string Summary { get; set; } - [J("text", NullValueHandling = N.Ignore)] public string Text { get; set; } - [J("tripId")] public object TripId { get; set; } - } + public class Leg { + [J("isWalking", NullValueHandling = N.Ignore)] + public bool? IsWalking { get; set; } - public class Stopover - { - [J("stop", NullValueHandling = N.Ignore)] public Stop Stop { get; set; } - [J("cancelled", NullValueHandling = N.Ignore)] public bool? Cancelled { get; set; } - [J("departure", NullValueHandling = N.Ignore)] public Arrival Departure { get; set; } - [J("arrival", NullValueHandling = N.Ignore)] public Arrival Arrival { get; set; } - } + [J("isTransfer", NullValueHandling = N.Ignore)] + public bool? IsTransfer { get; set; } - public class Params - { - [J("fromPoint", NullValueHandling = N.Ignore)] public Point FromPoint { get; set; } - [J("toPoint", NullValueHandling = N.Ignore)] public Point ToPoint { get; set; } - [J("viaPoint")] public object ViaPoint { get; set; } - [J("earlierRef")] public object EarlierRef { get; set; } - [J("laterRef")] public object LaterRef { get; set; } - [J("results")] public object Results { get; set; } - [J("stopovers", NullValueHandling = N.Ignore)] public bool? Stopovers { get; set; } - [J("polylines", NullValueHandling = N.Ignore)] public bool? Polylines { get; set; } - [J("remarks", NullValueHandling = N.Ignore)] public bool? Remarks { get; set; } - [J("bikeFriendly")] public object BikeFriendly { get; set; } - [J("tickets", NullValueHandling = N.Ignore)] public bool? Tickets { get; set; } - [J("startWithWalking")] public object StartWithWalking { get; set; } - [J("scheduledDays")] public object ScheduledDays { get; set; } - [J("accessibility", NullValueHandling = N.Ignore)] public string Accessibility { get; set; } - [J("transfers")] public object Transfers { get; set; } - [J("transferTime")] public object TransferTime { get; set; } - [J("arrival")] public object Arrival { get; set; } - [J("departure", NullValueHandling = N.Ignore)] public long? Departure { get; set; } - [J("products", NullValueHandling = N.Ignore)] public Products Products { get; set; } - } + [J("cancelled", NullValueHandling = N.Ignore)] + public bool? Cancelled { get; set; } - public partial class OeapiResponse - { - public static OeapiResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Converter.Settings); - } -} + [J("departure", NullValueHandling = N.Ignore)] + public Arrival Departure { get; set; } + + [J("arrival", NullValueHandling = N.Ignore)] + public Arrival Arrival { get; set; } + + [J("polyline")] public object Polyline { get; set; } + [J("distance")] public object Distance { get; set; } + + [J("line", NullValueHandling = N.Ignore)] + public Line Line { get; set; } + + [J("direction", NullValueHandling = N.Ignore)] + public string Direction { get; set; } + + [J("stopovers", NullValueHandling = N.Ignore)] + public List Stopovers { get; set; } + + [J("remarks", NullValueHandling = N.Ignore)] + public List Remarks { get; set; } + } + + public class Arrival { + [J("point", NullValueHandling = N.Ignore)] + public Point Point { get; set; } + + [J("plannedTime")] public long? PlannedTime { get; set; } + [J("prognosedTime")] public long? PrognosedTime { get; set; } + [J("plannedPlatform")] public string PlannedPlatform { get; set; } + [J("prognosedPlatform")] public object PrognosedPlatform { get; set; } + } + + public class Point { + [J("stop", NullValueHandling = N.Ignore)] + public Stop Stop { get; set; } + + [J("location")] public object Location { get; set; } + } + + public class Stop { + [J("id", NullValueHandling = N.Ignore)] + public string Id { get; set; } + + [J("name", NullValueHandling = N.Ignore)] + public string Name { get; set; } + + [J("location", NullValueHandling = N.Ignore)] + public Location Location { get; set; } + + [J("products", NullValueHandling = N.Ignore)] + public Products Products { get; set; } + + [J("station")] public object Station { get; set; } + } + + public class Location { + [J("latitude", NullValueHandling = N.Ignore)] + public double? Latitude { get; set; } + + [J("longitude", NullValueHandling = N.Ignore)] + public double? Longitude { get; set; } + + [J("name")] public object Name { get; set; } + [J("address")] public object Address { get; set; } + [J("id")] public object Id { get; set; } + } + + public class Products { + [J("nationalExp", NullValueHandling = N.Ignore)] + public bool? NationalExp { get; set; } + + [J("national", NullValueHandling = N.Ignore)] + public bool? National { get; set; } + + [J("regionalExp", NullValueHandling = N.Ignore)] + public bool? RegionalExp { get; set; } + + [J("regional", NullValueHandling = N.Ignore)] + public bool? Regional { get; set; } + + [J("suburban", NullValueHandling = N.Ignore)] + public bool? Suburban { get; set; } + + [J("bus", NullValueHandling = N.Ignore)] + public bool? Bus { get; set; } + + [J("ferry", NullValueHandling = N.Ignore)] + public bool? Ferry { get; set; } + + [J("subway", NullValueHandling = N.Ignore)] + public bool? Subway { get; set; } + + [J("tram", NullValueHandling = N.Ignore)] + public bool? Tram { get; set; } + + [J("taxi", NullValueHandling = N.Ignore)] + public bool? Taxi { get; set; } + } + + public class Line { + [J("id", NullValueHandling = N.Ignore)] + public string Id { get; set; } + + [J("name", NullValueHandling = N.Ignore)] + public string Name { get; set; } + + [J("mode", NullValueHandling = N.Ignore)] + public string Mode { get; set; } + + [J("product", NullValueHandling = N.Ignore)] + public string Product { get; set; } + + [J("tripNum", NullValueHandling = N.Ignore)] + public string TripNum { get; set; } + + [J("productName", NullValueHandling = N.Ignore)] + public string ProductName { get; set; } + + [J("fullProductName", NullValueHandling = N.Ignore)] + public string FullProductName { get; set; } + + [J("operator")] public object Operator { get; set; } + [J("additionalName")] public string AdditionalName { get; set; } + } + + public class Remark { + [J("type", NullValueHandling = N.Ignore)] + public string Type { get; set; } + + [J("code", NullValueHandling = N.Ignore)] + public string Code { get; set; } + + [J("summary")] public string Summary { get; set; } + + [J("text", NullValueHandling = N.Ignore)] + public string Text { get; set; } + + [J("tripId")] public object TripId { get; set; } + } + + public class Stopover { + [J("stop", NullValueHandling = N.Ignore)] + public Stop Stop { get; set; } + + [J("cancelled", NullValueHandling = N.Ignore)] + public bool? Cancelled { get; set; } + + [J("departure", NullValueHandling = N.Ignore)] + public Arrival Departure { get; set; } + + [J("arrival", NullValueHandling = N.Ignore)] + public Arrival Arrival { get; set; } + } + + public class Params { + [J("fromPoint", NullValueHandling = N.Ignore)] + public Point FromPoint { get; set; } + + [J("toPoint", NullValueHandling = N.Ignore)] + public Point ToPoint { get; set; } + + [J("viaPoint")] public object ViaPoint { get; set; } + [J("earlierRef")] public object EarlierRef { get; set; } + [J("laterRef")] public object LaterRef { get; set; } + [J("results")] public object Results { get; set; } + + [J("stopovers", NullValueHandling = N.Ignore)] + public bool? Stopovers { get; set; } + + [J("polylines", NullValueHandling = N.Ignore)] + public bool? Polylines { get; set; } + + [J("remarks", NullValueHandling = N.Ignore)] + public bool? Remarks { get; set; } + + [J("bikeFriendly")] public object BikeFriendly { get; set; } + + [J("tickets", NullValueHandling = N.Ignore)] + public bool? Tickets { get; set; } + + [J("startWithWalking")] public object StartWithWalking { get; set; } + [J("scheduledDays")] public object ScheduledDays { get; set; } + + [J("accessibility", NullValueHandling = N.Ignore)] + public string Accessibility { get; set; } + + [J("transfers")] public object Transfers { get; set; } + [J("transferTime")] public object TransferTime { get; set; } + [J("arrival")] public object Arrival { get; set; } + + [J("departure", NullValueHandling = N.Ignore)] + public long? Departure { get; set; } + + [J("products", NullValueHandling = N.Ignore)] + public Products Products { get; set; } + } + + public partial class OeapiResponse { + public static OeapiResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Converter.Settings); + } +} \ No newline at end of file diff --git a/bahnplan.web/JSON/TicketResponse.cs b/bahnplan.web/JSON/TicketResponse.cs index 7e00bce..685020d 100644 --- a/bahnplan.web/JSON/TicketResponse.cs +++ b/bahnplan.web/JSON/TicketResponse.cs @@ -246,8 +246,7 @@ namespace bahnplan.web.JSON { } public class Trainlist { - [J("train", NullValueHandling = NV.Ignore)] - [JsonConverter(typeof(SingleOrArrayConverter))] + [J("train", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter))] public List Train { get; set; } } @@ -411,22 +410,20 @@ namespace bahnplan.web.JSON { public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings { MetadataPropertyHandling = MetadataPropertyHandling.Ignore, DateParseHandling = DateParseHandling.None, - Converters = {new IsoDateTimeConverter {DateTimeStyles = DateTimeStyles.AssumeUniversal}}, + Converters = {new IsoDateTimeConverter {DateTimeStyles = DateTimeStyles.AssumeUniversal}} }; } internal class SingleOrArrayConverter : JsonConverter { - public override bool CanConvert(Type objectType) { - return objectType == typeof(List); - } + public override bool CanWrite => false; + + public override bool CanConvert(Type objectType) => objectType == typeof(List); public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var token = JToken.Load(reader); return token.Type == JTokenType.Array ? token.ToObject>() : new List {token.ToObject()}; } - public override bool CanWrite => false; - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { throw new NotImplementedException(); } diff --git a/bahnplan.web/Pages/Card.cshtml b/bahnplan.web/Pages/Card.cshtml index 892fd81..7d08995 100644 --- a/bahnplan.web/Pages/Card.cshtml +++ b/bahnplan.web/Pages/Card.cshtml @@ -5,7 +5,7 @@ @{ ViewData["Title"] = "Card"; Response.Redirect("/Cards"); - + if (HttpContext.Session.GetString("authorized") != "true") { Response.Redirect("/"); return; diff --git a/bahnplan.web/Pages/Card.cshtml.cs b/bahnplan.web/Pages/Card.cshtml.cs index bb5b103..76c9af8 100644 --- a/bahnplan.web/Pages/Card.cshtml.cs +++ b/bahnplan.web/Pages/Card.cshtml.cs @@ -4,22 +4,19 @@ using System.Xml; using System.Xml.Linq; using bahnplan.web.database; using bahnplan.web.database.Tables; -using bahnplan.web.JSON; using bahnplan.web.JSON.CardResponse; using bahnplan.web.JSON.ListOrdersResponse; using LinqToDB; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.RazorPages; using Newtonsoft.Json; -using Leg = bahnplan.web.database.Tables.Leg; namespace bahnplan.web.Pages { public class CardModel : PageModel { public void OnPost() { - if (HttpContext.Session.GetString("authorized") != "true") { + if (HttpContext.Session.GetString("authorized") != "true") return; - } - + using var db = new Database.DbConn(); var request = new XDocument(new XElement("rqorderheadlist", new XElement("rqheader", new XAttribute("ts", "2020-02-19T15:59:00"), new XAttribute("l", "de"), @@ -63,7 +60,7 @@ namespace bahnplan.web.Pages { ValidFrom = parsedCard.Rporderdetails.Order.Vfrom, ValidTo = parsedCard.Rporderdetails.Order.Vto, QrValidFrom = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigab").Text, - QrValidTo = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigbis").Text, + QrValidTo = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigbis").Text }); } } diff --git a/bahnplan.web/Pages/Cards.cshtml b/bahnplan.web/Pages/Cards.cshtml index 8c6ab17..d3d1078 100644 --- a/bahnplan.web/Pages/Cards.cshtml +++ b/bahnplan.web/Pages/Cards.cshtml @@ -8,37 +8,140 @@ Response.Redirect("/"); return; } + + if (Request.Query.ContainsKey("refresh")) { + Response.Redirect("?edit=true"); + return; + } } -@foreach (var card in Model.Cards) { - Ticketcode - Sichtmerkmal - - Bahncardimage - +@if (Request.Query["edit"] == "true") { + + + + + + + + + + + + + @foreach (var card in Model.Cards) { + + + + + + + + + } + +
CardNumberTravellerCard ValidityQR ValidityActions
@card.CardInfo.TrimEnd('#')@card.CardNumber@card.Traveller + @{ + var from = DateTime.Parse(card.ValidFrom); + var to = DateTime.Parse(card.ValidTo); + if (from > DateTime.Now) { + + @card.ValidFrom.Split("T")[0] + + } + else { + @card.ValidFrom.Split("T")[0] + } +
+ if (to < DateTime.Now) { + + @card.ValidTo.Split("T")[0] + + } + else { + @card.ValidTo.Split("T")[0] + } + } +
+ @{ + var qrfrom = DateTime.Parse(card.QrValidFrom); + var qrto = DateTime.Parse(card.QrValidTo); + if (qrfrom > DateTime.Now) { + + @card.QrValidFrom.Split("T")[0] + + } + else { + @card.QrValidFrom.Split("T")[0] + } +
+ if (qrto < DateTime.Now) { + + @card.QrValidTo.Split("T")[0] + + } + else { + @card.QrValidTo.Split("T")[0] + } + } +
+ Refresh QR + Delete +
+ Back +
+

} -

- Click on the BahnCard Image to remove a card. -

-
-
-
-
-
-
-

Get Cards from bahn.de account

-
-
-
- -
-
- -
-
- -
- @Html.AntiForgeryToken() - -
\ No newline at end of file +else if (Model.Cards.Any()) { + foreach (var card in Model.Cards) { + Ticketcode + Sichtmerkmal + Bahncardimage + var from = DateTime.Parse(card.ValidFrom); + var to = DateTime.Parse(card.ValidTo); + var qrfrom = DateTime.Parse(card.QrValidFrom); + var qrto = DateTime.Parse(card.QrValidTo); + + if (from > DateTime.Now) { + + } + if (to < DateTime.Now) { + + } + if (qrfrom > DateTime.Now && !(from > DateTime.Now)) { + + } + if (qrto < DateTime.Now) { + + } +
+ } +
+ Edit cards +} + +@if (!Model.Cards.Any() || Request.Query["edit"] == "true") { +

Get Cards from bahn.de account

+
+
+
+ +
+
+ +
+
+ +
+ @Html.AntiForgeryToken() + +
+} \ No newline at end of file diff --git a/bahnplan.web/Pages/Cards.cshtml.cs b/bahnplan.web/Pages/Cards.cshtml.cs index 6677679..c1ac354 100644 --- a/bahnplan.web/Pages/Cards.cshtml.cs +++ b/bahnplan.web/Pages/Cards.cshtml.cs @@ -1,20 +1,51 @@ using System.Collections.Generic; using System.Linq; +using System.Net; +using System.Xml; +using System.Xml.Linq; using bahnplan.web.database; using bahnplan.web.database.Tables; +using bahnplan.web.JSON.CardResponse; +using LinqToDB; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.RazorPages; +using Newtonsoft.Json; namespace bahnplan.web.Pages { public class CardsModel : PageModel { public List Cards; public void OnGet() { - if (HttpContext.Session.GetString("authorized") != "true") { + if (HttpContext.Session.GetString("authorized") != "true") + return; + + using var db = new Database.DbConn(); + + if (Request.Query.ContainsKey("refresh")) { + var card = db.Cards.First(p => p.CardId == int.Parse(Request.Query["refresh"])); + var request = new XDocument(new XElement("rqorderdetails", new XAttribute("version", "1.0"), + new XElement("rqheader", new XAttribute("ts", "2019-10-31T23:20:48"), new XAttribute("l", "de"), + new XAttribute("v", "19100000"), new XAttribute("d", "iPad7,5"), + new XAttribute("os", "iOS_13.1.3"), new XAttribute("app", "NAVIGATOR")), + new XElement("rqorder", new XAttribute("on", card.OrderId)), + new XElement("authname", new XAttribute("tln", card.Traveller.Split(" ").Last())))).ToString(); + + var response = new WebClient().UploadString("https://fahrkarten.bahn.de/mobile/dbc/xs.go", "POST", request); + var xmlobj = new XmlDocument(); + xmlobj.LoadXml(response); + var json = JsonConvert.SerializeXmlNode(xmlobj); + var parsedCard = CardResponse.FromJson(json); + + card.CardQr = parsedCard.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "barcode").Text; + card.CardSecCode = parsedCard.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "sichtmerkmal").Text; + card.CardImage = parsedCard.Rporderdetails.Order.Tcklist.Tck.Bahncardimage.CdataSection; + card.QrValidFrom = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigab").Text; + card.QrValidTo = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigbis").Text; + + db.Update(card); return; } - - using var db = new Database.DbConn(); + Cards = db.Cards.Where(p => p.UserId == int.Parse(HttpContext.Session.GetString("uid"))).ToList(); } } diff --git a/bahnplan.web/Pages/Delete.cshtml b/bahnplan.web/Pages/Delete.cshtml index be6c22f..fa70cf2 100644 --- a/bahnplan.web/Pages/Delete.cshtml +++ b/bahnplan.web/Pages/Delete.cshtml @@ -1,7 +1,6 @@ @page @using Microsoft.AspNetCore.Http @using bahnplan.web.database -@using System.Linq @model DeleteModel @{ ViewData["Title"] = "Home"; @@ -13,19 +12,19 @@ if (Request.Query.ContainsKey("confirm") && Request.Query["confirm"] == "true") { Layout = null; - Response.Redirect(Request.Headers["Referer"]); + Response.Redirect("/"); + return; } - else { -

Are you sure?

-

- You are attempting to delete - @{ - await using var db = new Database.DbConn(); - } - @switch (Request.Query["item"]) { +

Are you sure?

+

+ You are attempting to delete + @{ + await using var db = new Database.DbConn(); + + switch (Request.Query["item"]) { case "trip": { - var legs = db.Legs.Where(p => p.TripId == int.Parse(Request.Query["id"])).OrderBy(p => p.DepTime).ToList();; + var legs = db.Legs.Where(p => p.TripId == int.Parse(Request.Query["id"])).OrderBy(p => p.DepTime).ToList(); the trip from @legs.First().DepStation to @legs.Last().ArrStation, starting @legs.First().DepTime @@ -48,8 +47,8 @@ break; } } -

- Cancel - Confirm - } + } +

+ Cancel + Confirm } \ No newline at end of file diff --git a/bahnplan.web/Pages/Delete.cshtml.cs b/bahnplan.web/Pages/Delete.cshtml.cs index d0c58dc..6a5aff5 100644 --- a/bahnplan.web/Pages/Delete.cshtml.cs +++ b/bahnplan.web/Pages/Delete.cshtml.cs @@ -1,14 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Linq; using bahnplan.web.database; using bahnplan.web.database.Tables; using LinqToDB; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace bahnplan.web.Pages { public class DeleteModel : PageModel { diff --git a/bahnplan.web/Pages/Error.cshtml.cs b/bahnplan.web/Pages/Error.cshtml.cs index 7cc24f3..b4703a4 100644 --- a/bahnplan.web/Pages/Error.cshtml.cs +++ b/bahnplan.web/Pages/Error.cshtml.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; @@ -10,16 +6,14 @@ using Microsoft.Extensions.Logging; namespace bahnplan.web.Pages { [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public class ErrorModel : PageModel { + private readonly ILogger _logger; + + public ErrorModel(ILogger logger) => _logger = logger; + public string RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - private readonly ILogger _logger; - - public ErrorModel(ILogger logger) { - _logger = logger; - } - public void OnGet() { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; } diff --git a/bahnplan.web/Pages/Index.cshtml b/bahnplan.web/Pages/Index.cshtml index fc5ec18..1f93c41 100644 --- a/bahnplan.web/Pages/Index.cshtml +++ b/bahnplan.web/Pages/Index.cshtml @@ -1,7 +1,6 @@ @page @using Microsoft.AspNetCore.Http @using bahnplan.web.database -@using System.Linq @model IndexModel @{ ViewData["Title"] = "Home"; diff --git a/bahnplan.web/Pages/Index.cshtml.cs b/bahnplan.web/Pages/Index.cshtml.cs index 4c9b69a..dbbb4ea 100644 --- a/bahnplan.web/Pages/Index.cshtml.cs +++ b/bahnplan.web/Pages/Index.cshtml.cs @@ -1,13 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Linq; using bahnplan.web.database; using bahnplan.web.database.Tables; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace bahnplan.web.Pages { public class IndexModel : PageModel { diff --git a/bahnplan.web/Pages/Inspection.cshtml b/bahnplan.web/Pages/Inspection.cshtml index aeb06de..734f803 100644 --- a/bahnplan.web/Pages/Inspection.cshtml +++ b/bahnplan.web/Pages/Inspection.cshtml @@ -1,10 +1,10 @@ @page -@using bahnplan.web.database @using Microsoft.AspNetCore.Http +@using bahnplan.web.database @model InspectionModel @{ ViewData["Title"] = "Inspection"; - + if (HttpContext.Session.GetString("authorized") != "true") { Response.Redirect("/"); return; @@ -29,6 +29,32 @@ Ticketcode Sichtmerkmal Bahncardimage + + var from = DateTime.Parse(card.ValidFrom); + var to = DateTime.Parse(card.ValidTo); + var qrfrom = DateTime.Parse(card.QrValidFrom); + var qrto = DateTime.Parse(card.QrValidTo); + + if (from > DateTime.Now) { + + } + if (to < DateTime.Now) { + + } + if (qrfrom > DateTime.Now && !(from > DateTime.Now)) { + + } + if (qrto < DateTime.Now) { + + } } else {