Please enable JavaScript.
Coggle requires JavaScript to display documents.
REST-API - Coggle Diagram
REST-API
BUILDING
Create
Controllers/Api/
CustomersController
Template
WebAPI2 Empty
Configure
Global.asax.cs
Application_Start
GlobalConfiguration
.Configure(...)
WebApiConfig.Register
Using
System
.Web.Http
ASP.NET WebAPI
DTO
For
Seperating
Implementation
Representation
Create
Folder
Dto
In-Root
CustomerDto
Copy
All-Props
Of-Customer
Remove
Reference
DomainClass
ReplaceWith
DtoClasses
[Display]
[Min18YearsIfAMember]
Map
Customer
CustomerDto
Using
Automapper
AUTO-MAPPER
Install
Install-package
automapper
-version:4.1
Profile
In-App_Start
MappingProfile
Create
Extends
Profile
In-Ctor
Mapper.Create<...>()
Customer, CustomerDto
CustomerDto, Customer
Dto->Model
c => c.Id, opt => opt.Ignore()
.ForMember(..)
In-Global.asax.cs
In-App_start()
Mapper.Initialize(..)
c => c.AddProfile<MappingProfile>()
TESTING
MediaFormatter
Default
XML
In-Request
Content-Type
application/json
CAMEL-NOTATION
In-App_Start
WebApiConfig.cs
In-RegisterMthd
settings =
.JsonFormatter
.SerializerSettings
config.Formatters
.ContractResolver =
new CamelCaseProperty..
..NamesContractResolver()
.Formatting =
Formatting
.Indented
CONTROLLER