Пример #1
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)));
        }
Пример #2
0
        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)));
        }