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
TKey1Type of the first primary key property.
TKey2Type of the second primary key property.
TKey3Type of the third primary key property.
TModelModel type.
TDtoDTO type.
TFilterFilter 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
serviceIService<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
id1TKey1Value of the first primary key property.
id2TKey2Value of the second primary key property.
id3TKey3Value of the third primary key property.
cancellationTokenCancellationTokenToken to cancel the request.
Returns
- Task<IActionResult>
NoContentif 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
id1TKey1Value of the first primary key property.
id2TKey2Value of the second primary key property.
id3TKey3Value of the third primary key property.
includeIEnumerable<IInclusion<TModel>>Inclusions, passed as comma-separated property paths of related models (e.g. "category,photos"), each of up to MaxInclusionDepth properties.
cancellationTokenCancellationTokenToken to cancel the request.
Returns
- Task<ActionResult<TDto>>
DTO, or
NotFoundif 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
id1TKey1Value of the first primary key property.
id2TKey2Value of the second primary key property.
id3TKey3Value of the third primary key property.
dtoPatchJsonPatchDocument<TDto>JSON patch of the DTO.
cancellationTokenCancellationTokenToken to cancel the request.
Returns
- Task<IActionResult>
NoContentif the model is updated.