Table of Contents

Class MagicalizedController<TKey1, TKey2, TKey3, TModel, TDto, TFilter>

Namespace
Magicalizer.Api.Controllers
Assembly
Magicalizer.dll

Magicalized controller of models with a composite primary key of three properties.

public class MagicalizedController<TKey1, TKey2, TKey3, TModel, TDto, TFilter> : MagicalizedControllerBase<TModel, TDto, TFilter> where TModel : class, IModel, new() where TDto : class, IDto<TModel>, new() where TFilter : class, IFilter, new()

Type Parameters

TKey1

Type of the first primary key property.

TKey2

Type of the second primary key property.

TKey3

Type of the third primary key property.

TModel

Model type.

TDto

DTO type.

TFilter

Filter type.

Inheritance
ControllerBase<TModel, TDto>
MagicalizedControllerBase<TModel, TDto, TFilter>
MagicalizedController<TKey1, TKey2, TKey3, TModel, TDto, TFilter>
Inherited Members

Constructors

MagicalizedController(IService<TKey1, TKey2, TKey3, TModel, TFilter>)

Creates a controller.

public MagicalizedController(IService<TKey1, TKey2, TKey3, TModel, TFilter> service)

Parameters

service IService<TKey1, TKey2, TKey3, TModel, TFilter>

Service of the models.

Fields

service

Service of the models.

protected readonly IService<TKey1, TKey2, TKey3, TModel, TFilter> service

Field Value

IService<TKey1, TKey2, TKey3, TModel, TFilter>

Methods

DeleteAsync(TKey1, TKey2, TKey3, CancellationToken)

Deletes the model by the composite primary key.

[HttpDelete("{id1}/{id2}/{id3}")]
public virtual Task<IActionResult> DeleteAsync(TKey1 id1, TKey2 id2, TKey3 id3, CancellationToken cancellationToken = default)

Parameters

id1 TKey1

Value of the first primary key property.

id2 TKey2

Value of the second primary key property.

id3 TKey3

Value of the third primary key property.

cancellationToken CancellationToken

Token to cancel the request.

Returns

Task<IActionResult>

NoContent if the model is deleted.

GetAsync(TKey1, TKey2, TKey3, IEnumerable<IInclusion<TModel>>?, CancellationToken)

Gets the DTO by the composite primary key.

[HttpGet("{id1}/{id2}/{id3}")]
public virtual Task<ActionResult<TDto>> GetAsync(TKey1 id1, TKey2 id2, TKey3 id3, IEnumerable<IInclusion<TModel>>? include = null, CancellationToken cancellationToken = default)

Parameters

id1 TKey1

Value of the first primary key property.

id2 TKey2

Value of the second primary key property.

id3 TKey3

Value of the third primary key property.

include IEnumerable<IInclusion<TModel>>

Inclusions, passed as comma-separated property paths of related models (e.g. "category,photos"), each of up to MaxInclusionDepth properties.

cancellationToken CancellationToken

Token to cancel the request.

Returns

Task<ActionResult<TDto>>

DTO, or NotFound if it doesn't exist.

PatchAsync(TKey1, TKey2, TKey3, JsonPatchDocument<TDto>, CancellationToken)

Partially updates the model by the composite primary key with a JSON patch.

[HttpPatch("{id1}/{id2}/{id3}")]
public virtual Task<IActionResult> PatchAsync(TKey1 id1, TKey2 id2, TKey3 id3, JsonPatchDocument<TDto> dtoPatch, CancellationToken cancellationToken = default)

Parameters

id1 TKey1

Value of the first primary key property.

id2 TKey2

Value of the second primary key property.

id3 TKey3

Value of the third primary key property.

dtoPatch JsonPatchDocument<TDto>

JSON patch of the DTO.

cancellationToken CancellationToken

Token to cancel the request.

Returns

Task<IActionResult>

NoContent if the model is updated.