https://github.com/timothyjan/todoapi-asp.netcorewebapi
TodoApi using the ASP.NET Core Web API.
https://github.com/timothyjan/todoapi-asp.netcorewebapi
Last synced: about 1 year ago
JSON representation
TodoApi using the ASP.NET Core Web API.
- Host: GitHub
- URL: https://github.com/timothyjan/todoapi-asp.netcorewebapi
- Owner: TimothyJan
- Created: 2024-08-19T23:16:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-20T18:38:44.000Z (almost 2 years ago)
- Last Synced: 2025-01-31T06:08:21.486Z (over 1 year ago)
- Language: C#
- Size: 16.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TodoApi-ASP.NetCoreWebAPI
TodoApi using the ASP.NET Core Web API. Controller-based web API that uses a database. Tutorial link
Design

Swagger Documentation
link
Notes:
- A model is a set of classes that represent the data that the app manages. The model for this app is the TodoItem class.
- The database context is the main class that coordinates Entity Framework functionality for a data model. In ASP.NET Core, services such as the DB context must be registered with the dependency injection (DI) container. The container provides the service to controllers.
- Add new Scaffolded Item in the Controllers folder to generate code.
- The return type of
ActionResult<T>type. ASP.NET Core automatically serializes the object to JSON and writes the JSON into the body of the response message.
Prevent over-posting:
- Production apps typically limit the data that's input and returned using a subset of the model.
- There are multiple reasons behind this, and security is a major one.
- The subset of a model is usually referred to as a Data Transfer Object (DTO), input model, or view model.
- A DTO may be used to:
- Prevent over-posting.
- Hide properties that clients are not supposed to view.
- Omit some properties in order to reduce payload size.
- Flatten object graphs that contain nested objects. Flattened object graphs can be more convenient for clients.