public async Task <IActionResult> Update(int id, [FromBody] EventCollectionDto dto) { var collection = await _eventCollectionRetrievalService .GetCollectionByIdAsync(id, new EventCollectionRetrievalOptions { ForUpdate = true }); dto.CopyTo(collection); await _eventCollectionManagementService.UpdateCollectionAsync(collection); return(Ok(new EventCollectionDto(collection))); }
public async Task <IActionResult> Create([FromBody] EventCollectionDto dto) { if (!ModelState.IsValid) { return(BadRequest(ModelState.FormatErrors())); } var collection = new EventCollection(); dto.CopyTo(collection); await _eventCollectionManagementService.CreateCollectionAsync(collection); return(Ok(new EventCollectionDto(collection))); }