Example #1
0
        public async Task <ActionResult> TipSlot()
        {
            var item = await PaytopiaReader.GetItem(PaytopiaItemType.TipSlot);

            var items = await PaytopiaReader.GetTipSlotItems();

            var balance = await UserBalanceReader.GetBalance(User.Identity.GetUserId(), item.CurrencyId);

            return(View("TipSlotModal", new TipSlotModel
            {
                Items = items,
                Balance = balance?.Available ?? 0,
                Currency = item.Symbol,
                Price = item.Price,
                Name = item.Name,
                Description = item.Description
            }));
        }
Example #2
0
        public async Task <ActionResult> TipSlot(TipSlotModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Items = await PaytopiaReader.GetTipSlotItems();

                return(View("TipSlotModal", model));
            }

            var result = await PaytopiaWriter.UpdateTipSlot(User.Identity.GetUserId(), model);

            if (!ModelState.IsWriterResultValid(result))
            {
                model.Items = await PaytopiaReader.GetTipSlotItems();

                return(View("TipSlotModal", model));
            }

            return(CloseModal(result));
        }