This coding task is for a .NET developer and assumes that you are familiar with .NET Core, MVC and REST.
Your task is to build a simple API that manages users using the controller in the provided project file.
There is no absolute time limit and we won't judge you on how long it took you to complete, however we would suggest you spend no more than 2 hours on this task.
- You must use .NET Core and C#
- The API should be a ASP.NET Core Web API project
- The API should consume and return data as JSON
- You may ignore any security implications, e.g. HTTPS or attempting to authenticate/authorize
- You may ignore persistent storage. Please use the provided in-memory cache
- You may use any NuGet packages you wish but be prepared to justify their usage
- You must use MediatR to implement the web APIs using the CQRS pattern where the implementation of queries and commands can be found inside handlers of the domain project, with the web project responsible for forwarding the commands or queries.
You must develop an API that exposes one RESTful endpoint. This endpoint should provide standard CRUD functionality for Users.
POST
/api/users
GET
/api/users
/api/users/{id}
DELETE
/api/users/{id}
PUT
/api/users/{id}
Field Name | Data Type | Required | Validation |
---|---|---|---|
FirstName | string |
true | max length 128 |
LastName | string |
false | max length 128 |
string |
true | must validate to a typical email address | |
DateOfBirth | DateTime |
true | must validate to a valid date |
- Every user must have a unique email address
- Users must be 18 years or older at the time of the creation request
- When returning one user or a list of users include the age of the user in the response as well as the date of birth
Your code should be production quality and utilise design patterns where appropriate. It should conform to best practices and principles such as SOLID, etc. Other things we will take into consideration:
- Code should be testable
- We expect you to be mindful of correct HTTP status code usage
To get started clone this repository and when done push it to private repository on your own GitHub account. Add user n3o-github
as a collaborator so we can take a look.