public async Task <Result <int> > Handle(UpdateLineItemCommand command, CancellationToken cancellationToken) { var lineItem = await _lineItemRepository.GetByIdAsync(command.Id); if (lineItem == null) { return(Result <int> .Fail($"LineItem Not Found.")); } else { lineItem.ClaimId = command.ClaimId; lineItem.CategoryId = command.CategoryId; lineItem.Payee = command.Payee; lineItem.Date = command.Date; lineItem.Description = command.Description; lineItem.Amount = command.Amount; lineItem.CurrencyId = command.CurrencyId; lineItem.USDAmount = command.USDAmount; await _lineItemRepository.UpdateAsync(lineItem); await _unitOfWork.Commit(cancellationToken); return(Result <int> .Success(lineItem.Id)); } }
public async Task <Result <int> > Handle(UpdateLineItemImageCommand command, CancellationToken cancellationToken) { var lineItem = await _lineItemRepository.GetByIdAsync(command.Id); if (lineItem == null) { throw new ApiException($"LineItem Not Found."); } else { lineItem.Receipt = command.Receipt; await _lineItemRepository.UpdateAsync(lineItem); await _unitOfWork.Commit(cancellationToken); return(Result <int> .Success(lineItem.Id)); } }