示例#1
0
        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!
            }
        }
示例#2
0
        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)));
        }