Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateCardAsync([FromBody] UpdateCardCommand command)
        {
            if (command == null)
            {
                return(BadRequest());
            }

            var cardToUpdate = new Card
            {
                Id          = command.Id,
                Name        = command.Name,
                Description = command.Description
            };

            var updatedCard = await _cardsService.UpdateCardAsync(cardToUpdate);

            if (updatedCard == null)
            {
                return(NotFound());
            }

            var response = new CardResponse
            {
                Id          = updatedCard.Id,
                Name        = updatedCard.Name,
                Description = updatedCard.Description
            };

            return(Ok(response));
        }