public async Task <IResult> UpdateAsync(CurrentCardUpdateDto currentCardUpdateDto)
        {
            var forUpdate = await this.GetByIdAsync(currentCardUpdateDto.Id);

            if (!forUpdate.Success)
            {
                return(forUpdate);
            }

            var mappedEntity = _mapper.Map(currentCardUpdateDto, forUpdate.Data);

            var result = await _currentCardDal.UpdateAsync(mappedEntity);

            if (!result)
            {
                return(new ErrorResult(Messages.CurrentCardNotUpdated));
            }

            return(new SuccessResult(Messages.CurrentCardUpdated));
        }
예제 #2
0
        public async Task <IActionResult> UpdateAsync(CurrentCardUpdateDto currentCardUpdateDto)
        {
            var result = await _currentCardService.UpdateAsync(currentCardUpdateDto);

            return(result.Success == false?BadRequest(result) : Ok(result));
        }