diff --git a/bahnplan.web/Pages/Index.cshtml b/bahnplan.web/Pages/Index.cshtml index e83554e..8dd2fad 100644 --- a/bahnplan.web/Pages/Index.cshtml +++ b/bahnplan.web/Pages/Index.cshtml @@ -23,13 +23,11 @@ - - @@ -44,22 +42,27 @@ foreach (var trip in trips.OrderBy(p => db.Legs.First(a => a.TripId == p.TripId).DepTime)) { var legs = db.Legs.Where(p => p.TripId == trip.TripId).OrderBy(p => p.DepTime).ToList(); - var dates = DateTime.Parse(legs.First().DepTime).Date == DateTime.Parse(legs.Last().DepTime).Date ? legs.First().DepTime.Substring(0, 10) : legs.First().DepTime.Substring(0, 10) + "
" + legs.Last().DepTime.Substring(0, 10); - - - + + - } diff --git a/bahnplan.web/Pages/Login.cshtml.cs b/bahnplan.web/Pages/Login.cshtml.cs index b621bfe..2361004 100644 --- a/bahnplan.web/Pages/Login.cshtml.cs +++ b/bahnplan.web/Pages/Login.cshtml.cs @@ -47,6 +47,7 @@ namespace bahnplan.web.Pages { return Convert.ToBase64String(plainTextBytes); } - public static string UrlEncode(this string plainText) => HttpUtility.UrlEncode(plainText); + public static string UrlEncode(this string plainText) => HttpUtility.UrlEncode(plainText); + public static string Delimit(this string input, int max) => input.PadRight(max, ' ').Substring(0, max).TrimEnd(); } } \ No newline at end of file
Date Origin Via Destination Comments ActionsDanger zone
@Html.Raw(dates)@Html.Raw(legs.First().DepStation.PadRight(30, ' ').Substring(0, 30).TrimEnd()) - @((from index in from leg in legs where leg.TrainType == "placeholder" select legs.IndexOf(leg) select legs[index - 1].ArrStation).ToList().DefaultIfEmpty("-").Aggregate((s1, s2) => $"{s1}, {s2}")) + @legs.First().DepStation.Delimit(30) +
+ @DateTime.Parse(legs.First().DepTime).ToString("ddd dd.MM.yyyy, HH:mm")
@Html.Raw(legs.Last().ArrStation.PadRight(30, ' ').Substring(0, 30).TrimEnd()) - @Html.Raw(legs.Where(leg => !string.IsNullOrWhiteSpace(leg.Comment)).Select(p => p.Comment).DefaultIfEmpty("").Aggregate((s1, s2) => $"{s1}
{s2}")) + @((from index in from leg in legs where leg.TrainType == "placeholder" select legs.IndexOf(leg) select legs[index - 1].ArrStation.Delimit(30)).ToList().DefaultIfEmpty("-").Aggregate((s1, s2) => $"{s1}, {s2}")) +
+ @legs.Last().ArrStation.Delimit(30) +
+ @DateTime.Parse(legs.Last().DepTime).ToString("ddd dd.MM.yyyy, HH:mm") +
+ @Html.Raw(legs.Where(leg => !string.IsNullOrWhiteSpace(leg.Comment)).Select(p => p.Comment.Replace(", ", "
")).DefaultIfEmpty("").Aggregate((s1, s2) => $"{s1}
{s2}"))
View - - Delete Trip +   + Delete