diff --git a/RaceLapTimer/RaceLapTimer/ApiControllers/PilotApiModule.cs b/RaceLapTimer/RaceLapTimer/ApiControllers/PilotApiModule.cs index ee7cdae..28f2001 100644 --- a/RaceLapTimer/RaceLapTimer/ApiControllers/PilotApiModule.cs +++ b/RaceLapTimer/RaceLapTimer/ApiControllers/PilotApiModule.cs @@ -38,27 +38,30 @@ namespace RaceLapTimer.ApiControllers Directory.CreateDirectory(uploadDirectory); } - var file = Request.Files.First(); - - var newFileName = Guid.NewGuid(); - var generatedFileName = string.Format("{0}{1}", newFileName, Path.GetExtension(file.Name)); //0000-0000.....ext - - var filename = Path.Combine(uploadDirectory, generatedFileName); - - using (var fileStream = new FileStream(filename, FileMode.Create)) + if (Request.Files.Any()) { - file.Value.CopyTo(fileStream); - fileStream.Flush(); - fileStream.Close(); + var file = Request.Files.First(); + + var newFileName = Guid.NewGuid(); + var generatedFileName = string.Format("{0}{1}", newFileName, Path.GetExtension(file.Name)); //0000-0000.....ext + + var filename = Path.Combine(uploadDirectory, generatedFileName); + + using (var fileStream = new FileStream(filename, FileMode.Create)) + { + file.Value.CopyTo(fileStream); + fileStream.Flush(); + fileStream.Close(); + } + + pilot.ImageUrl = "/images/" + generatedFileName; + _provider.UpdatePilot(pilot); + + File.Delete(Path.Combine(uploadDirectory, oldImagePath)); + } - - pilot.ImageUrl = "/images/" + generatedFileName; - _provider.UpdatePilot(pilot); - - File.Delete(Path.Combine(uploadDirectory, oldImagePath)); - string returnurl = "/pilot/edit/" + pilotId; - return Context.GetRedirect(returnurl); + return Context.GetRedirect(returnurl); } private dynamic DeletePilot(dynamic args) diff --git a/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj b/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj index 0e1115b..336c25f 100644 --- a/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj +++ b/RaceLapTimer/RaceLapTimer/RaceLapTimer.csproj @@ -166,7 +166,9 @@ Always - + + Always + Always @@ -191,7 +193,9 @@ Always - + + Always + @@ -218,6 +222,9 @@ Always + + Always + Always diff --git a/RaceLapTimer/RaceLapTimer/www/Views/HistoryIndex.cshtml b/RaceLapTimer/RaceLapTimer/www/Views/HistoryIndex.cshtml index 61209b5..31824ad 100644 --- a/RaceLapTimer/RaceLapTimer/www/Views/HistoryIndex.cshtml +++ b/RaceLapTimer/RaceLapTimer/www/Views/HistoryIndex.cshtml @@ -4,6 +4,7 @@ ViewBag.Title = "History"; }

@ViewBag.Title

+ @@ -17,17 +18,19 @@ - - - - - - + + + + + + - +
June 16, 2017 19:07Race Name 1standard5
Race Name 1standard5 + +
diff --git a/RaceLapTimer/RaceLapTimer/www/css/site.css b/RaceLapTimer/RaceLapTimer/www/css/site.css new file mode 100644 index 0000000..e72b277 --- /dev/null +++ b/RaceLapTimer/RaceLapTimer/www/css/site.css @@ -0,0 +1,3 @@ +.table>tbody>tr>td.vertical-center { + vertical-align: middle; +} \ No newline at end of file diff --git a/RaceLapTimer/RaceLapTimer/www/js/raceHistory.js b/RaceLapTimer/RaceLapTimer/www/js/raceHistory.js index f479ec2..4594015 100644 --- a/RaceLapTimer/RaceLapTimer/www/js/raceHistory.js +++ b/RaceLapTimer/RaceLapTimer/www/js/raceHistory.js @@ -13,19 +13,26 @@ var mappedSessions = $.map(allData.data, function (item) { return new RaceSession(item) }); self.sessions(mappedSessions); }); + self.toggleIcon = function(e) { + $(e).toggleClass("glyphicon-plus glyphicon-minus"); + } }; ko.applyBindings(new ViewModel()); function toggleIcon(e) { $(e.target) .toggleClass("glyphicon-plus glyphicon-minus"); } -$(".dataTable").on("hidden.bs.collapse", - function toggleIcon(e) { - $(e.target) - .toggleClass("glyphicon-plus glyphicon-minus"); - }); -$(".dataTable").on("shown.bs.collapse", - function toggleIcon(e) { - $(e.target) - .toggleClass("glyphicon-plus glyphicon-minus"); - }); \ No newline at end of file +//$(".dataTable").on("hidden.bs.collapse", +// function toggleIcon(e) { +// $(e.target) +// .find("tr.collapse") +// .find("td") +// .toggleClass("glyphicon-plus glyphicon-minus"); +// }); +//$(".dataTable").on("shown.bs.collapse", +// function toggleIcon(e) { +// $(e.target) +// .find("tr.collapse") +// .find("td") +// .toggleClass("glyphicon-plus glyphicon-minus"); +// }); \ No newline at end of file