Ritu Singh
Problem:
I've done basic sorts before and not had an issue, but this one has me stumped as to what I am doing wrong. All it returns is a blank page.
Details.cs (showing the sort code)
Pet Details view where the sort occurs (shortened for space):
If someone could point out where I have gone astray, I would much appreciate it! I have learned a lot from this forum so far that I have been able to apply on multiple apps!
ADDED: Update based on suggestion
Solution:
I'll start off with a few QoL improvements.
You used 14 lines to describe sorting:
There's something to be said for keeping it like this if you expect multiple sorting methods to be added in the future. However, the devil is in the details:
Why are you making the VaxDateSort the opposite of sortOrder? Why even have a seperate property if you don't mutate it afterwards?
Since VaxDateSort is implied to always have a value, you can add the default switch statement to another case, like:
Now, you already had some help with fixing some of your other mistakes, so putting it all together with your improved version and fixing the last mistakes you made (vax was the datetime parameter of your method, not the db list), this should let your code compile at least.
I recommend taking a close look at the official MS documentation example of what you're trying to do and cross-referencing >https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-8.0&tabs=visual-studio
Suggested blogs:
>Step by Step guide to Deploy Terraform in Azure using GitHub Actions
>Testing react components using Hooks and Mocks
>Use Firebase Realtime Database with ASP.NET MVC App
>Use of Singletons in .NET Core in AWS Lambda
>How to do PHP Decryption from Node.js Encryption
>How to Set up the Android emulator?
>How to Set up the local environment for Angular development?
>How to solve encoding issue when writing to a text file, with Python?