public async Task <IActionResult> Update(int id, [FromBody] EventCollectionDto dto) { try { var collection = await _eventCollectionRetrievalService .GetCollectionByIdAsync(id, new EventCollectionRetrievalOptions { ForUpdate = true }); dto.CopyTo(collection); await _eventCollectionManagementService.UpdateCollectionAsync(collection); return(Ok(new EventCollectionDto(collection))); } catch (NotFoundException e) { return(NotFound(e.Message)); } catch (NotAccessibleException e) { return(NotFound(e.Message)); // FIXME: can't return FORBIDDEN, it will redirect to login page! } }
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))); }