Beispiel #1
0
        public async Task <ActionResult <BalanceViewModel> > UpdateBalance(Guid id, [FromBody] BalanceUpdateModel updateModel)
        {
            UserViewModel user = await GetCurrentUserAsync();

            if (user == null)
            {
                return(HandleUserNotFoundResult());
            }

            BalanceViewModel result = await _balanceService.UpdateBalanceAsync(user.Id, id, updateModel);

            return(HandleResult(result));
        }
Beispiel #2
0
        public async Task GivenISetBalanceValueTo(string assetName, decimal value)
        {
            AssetViewModel asset = await _assetFeatureContext.AssetService.GetAssetByNameAsync(_userContext.UserId, assetName);

            _balanceUpdateModel = new BalanceUpdateModel(asset.Id, value);
        }
Beispiel #3
0
        public async Task <BalanceViewModel> UpdateBalanceAsync(Guid userId, Guid id, BalanceUpdateModel updateModel)
        {
            Balance balance = await _balanceRepository.UpdateAsync(userId, id, updateModel.AssetId, updateModel.Value);

            await _unitOfWork.SaveChangesAsync();

            BalanceViewModel result = new BalanceViewModel(balance);

            return(result);
        }