A simple demo project showing the structure and usage of ASP.NET Core with WebAPI and Entity Framework Core
- Visual Studio 2022
- .NET 6
- Any supported SQL server
- Entity Framework Core tools
- Based on .NET 6 and AspNetCore 6 with C# 10
- Entity Framework Core 6 (Code-First approach)
- Extendable code with MVC (MVCS) architecture and Repository pattern
- Swagger for development
- AutoMapper used to handle models mapping
- Clone the repository
git clone https://github.com/akikodev/TaskManagerWebAPI.git
- Open the solution file in Visual Studio
- Configure database
DefaultConnection
insideappsettings.json
- Add migrations and update database using Terminal window
dotnet ef migrations add InitialCreate
dotnet ef database update
- And finally run the app
dotnet run
- Now it can be accessed through
localhost:5201/swagger/index.html
POST Create a new project
http://localhost:5201/api/v1/Project
GET Get all existing projects
http://localhost:5201/api/v1/Project
GET Get a project by id
http://localhost:5201/api/v1/Project/{projectId}
PUT Update a project by id
http://localhost:5201/api/v1/Project/{projectId}
DELETE Delete a project by id
http://localhost:5201/api/v1/Project/{projectId}
GET Gets project tasks
http://localhost:5201/api/v1/Project/{projectId}/Tasks
POST Create a new task
http://localhost:5201/api/v1/Task
GET Get all existing tasks
http://localhost:5201/api/v1/Task
GET Get a task by id
http://localhost:5201/api/v1/Task/{taskId}
PUT Update a task by id
http://localhost:5201/api/v1/Task/{taskId}
DELETE Delete a task by id
http://localhost:5201/api/v1/Task/{taskId}
PUT Add task to a specified project
http://localhost:5201/api/v1/Task/{taskId}/AddToProject/{projectId}
POST Remove task from referenced project
http://localhost:5201/api/v1/Task/{taskId}/RemoveFromProject
Copyright 2022 Aki Aoki
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.