This challenge is designed to evaluate your skills as a full stack developer using .NET 6 (C#), Entity Framework Core, Razor Pages, and REST API integration.
You'll be working with a project that simulates tracking cryptocurrency prices using the CoinGecko API.
-
Open
CryptoPriceService.csand fix the logic so it correctly:- Fetches coin data from CoinGecko for all existing coins
Documentation: https://docs.coingecko.com/v3.0.1/reference/introduction - Handles async operations properly
- Prevents duplicate entries
- Saves the results to the SQLite database
⚠️ If you encounter duplicate entries or errors from the CoinGecko API, decide how to handle them.
You're free to choose the best approach — just make sure you explain your reasoning in a short code comment.⚠️ Some files may have outdated or incorrectnamespacedeclarations. Please review and update them as needed to ensure consistency across the project. - Fetches coin data from CoinGecko for all existing coins
- Open
CryptoController.csand:- Complete the
POST /api/crypto/update-pricesendpoint - Add a
GET /api/crypto/latest-pricesendpoint to return the most recent price per asset. All available cryptocoins must be saved.
- Complete the
- The view in
/Views/Home/Index.cshtmlincludes a button to call the API. - Ensure that the interface provides clear feedback to the user indicating whether the update succeeded or failed.
Build a clean and user-friendly visualization directly in the existing Razor view:
/Views/Home/Index.cshtml
This page must:
-
Display each cryptocurrency asset with at least the following fields:
- ✅ Name
- ✅ Symbol
- ✅ Current Price
- ✅ Currency
- ✅ Icon
- Add the
IconUrlproperty to theCryptoAssetmodel - Retrieve the image url from CoinGecko
- Save it to the database
- Add the
- ✅ Last Updated
- This value must be converted to the client's local timezone using JavaScript
- ✅ Trend
- Add a visual indicator showing whether the price has increased, decreased, or stayed the same compared to the previous saved price (e.g., 🔼, 🔽, ➖)
- Optionally, include the percentage change
-
Use the existing "Update Prices" button to trigger the API and refresh the data displayed in the view.
🎯 Goal: The user should be able to open the page, see the most recent cryptocurrency data clearly presented, and update it with one click.
💡 Bonus points for improved UI, animations, or anything that enhances clarity and usability.
- Add validation logic or error handling where needed
- Create unit tests for validator or service logic
- Make sure you have .NET 6 SDK installed.
- Navigate to the backend project folder:
cd Backend/CryptoPriceTracker.Api - Restore dependencies:
dotnet restore
- Generate your own migrations and update the database:
dotnet ef migrations add InitialCreate dotnet ef database update
- Run the project:
dotnet run
- Navigate to
http://localhost:5000to test the Razor page.
You may add unit tests to demonstrate how you validate business logic (e.g., in the PriceValidator class).
To run this solution, ensure you have the .NET 6 SDK installed.
Since this is a .NET 6 project, you must install the compatible version of the EF tool:
dotnet tool install --global dotnet-ef --version "6.*"Note: If the command is not found after installation, add the tools to your path: export PATH="$PATH:$HOME/.dotnet/tools"
Navigate to the API project folder and apply the migrations:
cd CryptoPriceTracker.Api
dotnet ef migrations add AddIconUrl
dotnet ef database updatedotnet runNavigate to http://localhost:5000 to view the dashboard.
A separate test project has been added to validate business logic:
cd ..
dotnet test- Namespaces: Standardized all project files with
CryptoPriceTracker.Api.*namespaces for better organization and consistency. - Test Project: Added
CryptoPriceTracker.Testsusing xUnit to isolate business logic testing from the main API.
- Endpoint: Switched to
/coins/marketsto retrieve names, symbols, current prices, and icon URLs in a single optimized request. - User-Agent: Added a custom User-Agent header to the
HttpClientas required by the CoinGecko API to prevent request blocking.
- Strategy: Duplicates are prevented by checking if a record already exists for the same asset with the same price on the same calendar day. This ensures the history remains clean while still allowing daily tracking.
- Technology: Built a custom, responsive dashboard using Vanilla CSS and JavaScript within the Razor view.
- Timezone: All "Last Updated" timestamps are converted to the user's local timezone in the browser to ensure accuracy for global users.
-
CryptoPriceService.csfetches, saves, and avoids duplicates correctly -
namespacedeclarations are consistent and correct across all files -
POST /api/crypto/update-pricesendpoint is functional -
GET /api/crypto/latest-pricesendpoint returns most recent prices -
IconUrlproperty added toCryptoAssetmodel and stored in DB - Razor page (
Index.cshtml) includes:- Name
- Symbol
- Current Price and currency
- Icon
- Last Updated (adjusted to client timezone)
- Trend (up/down indicator and percentage change)
- Button updates data and refreshes the view
- Clear UI feedback after update attempts (success/failure)
- Validation/error handling is implemented where needed
- At least one unit test demonstrates validation logic
- Comments provided for any assumptions or technical decisions
Good luck, and thank you for taking the time to complete this challenge!