public JsonResult GetWalletCurrencyAmount(int walletID, int currencyID) { try { var result = walletService.CanAccessWallet(walletID, SessionHelper.CurrentEntity.EntityID); if (result.IsError) { return(JsonError(result)); } decimal amount = walletRepository.GetMoneyAmount(walletID, currencyID); return(JsonData(amount)); } catch (Exception e) { return(JsonDebugOnlyError(e)); } }
public ActionResult BuyOfferWithWallet(int entityID, int offerID, int amount, int walletID) { var result = walletService.CanAccessWallet(walletID, SessionHelper.CurrentEntity.EntityID); if (result.IsError) { return(RedirectBackWithError(result)); } var offer = marketOfferRepository.GetById(offerID); var entity = entityRepository.GetById(entityID); result = marketService.CanBuyOffer(offer, amount, entity, walletID); if (result.IsError) { return(RedirectBackWithError(result)); } marketService.Buy(offer, entity, amount, walletID); return(RedirectBackWithInfo(string.Format("You sucessfuly bought {0} {1}", amount, MarketOfferExtensions.GetProductType(offer).ToHumanReadable()))); }