diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs index 83ac9b4..c9e78b3 100644 --- a/Controllers/VehicleController.cs +++ b/Controllers/VehicleController.cs @@ -1266,6 +1266,7 @@ namespace CarCareTracker.Controllers public IActionResult GetNotesByVehicleId(int vehicleId) { var result = _noteDataAccess.GetNotesByVehicleId(vehicleId); + result = result.OrderByDescending(x => x.Pinned).ToList(); return PartialView("_Notes", result); } [HttpPost] diff --git a/Models/Note.cs b/Models/Note.cs index eb8e59e..f344c25 100644 --- a/Models/Note.cs +++ b/Models/Note.cs @@ -6,5 +6,6 @@ public int VehicleId { get; set; } public string Description { get; set; } public string NoteText { get; set; } + public bool Pinned { get; set; } } } diff --git a/Views/Vehicle/_NoteModal.cshtml b/Views/Vehicle/_NoteModal.cshtml index 2dcff4c..169cc27 100644 --- a/Views/Vehicle/_NoteModal.cshtml +++ b/Views/Vehicle/_NoteModal.cshtml @@ -12,6 +12,10 @@
+
+ + +
diff --git a/wwwroot/js/note.js b/wwwroot/js/note.js index f44b31f..b71673a 100644 --- a/wwwroot/js/note.js +++ b/wwwroot/js/note.js @@ -67,6 +67,7 @@ function getAndValidateNoteValues() { var noteText = $("#noteTextArea").val(); var vehicleId = GetVehicleId().vehicleId; var noteId = getNoteModelData().id; + var noteIsPinned = $("#noteIsPinned").is(":checked"); //validation var hasError = false; if (noteDescription.trim() == '') { //eliminates whitespace. @@ -86,6 +87,7 @@ function getAndValidateNoteValues() { hasError: hasError, vehicleId: vehicleId, description: noteDescription, - noteText: noteText + noteText: noteText, + pinned: noteIsPinned } } \ No newline at end of file