Example #1
0
        public CardDto EditCard(EditCardNameDto cardDto, string userId)
        {
            if (!_cardRepository.IsOwner(cardDto.Id, userId))
            {
                return(null);
            }

            var card       = _mapper.Map <Card>(cardDto);
            var editedCard = _cardRepository.UpdateCardName(card);
            var result     = _mapper.Map <CardDto>(editedCard);

            return(result);
        }
Example #2
0
        public IActionResult EditCardName([FromBody] EditCardNameDto cardDto)
        {
            var userId     = User.GetUserId();
            var editedCard = _cardService.EditCard(cardDto, userId);

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

            _cardDetailsHub.Clients.Group(cardDto.Id.ToString()).ChangedName(cardDto.Name);

            return(NoContent());
        }