Ejemplo n.º 1
0
        public async Task <ActionResult> RewardSlot()
        {
            var item = await PaytopiaReader.GetItem(PaytopiaItemType.RewardSlot);

            var items = await PaytopiaReader.GetRewardSlotItems();

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

            return(View("RewardSlotModal", new RewardSlotModel
            {
                Items = items,
                Balance = balance?.Available ?? 0,
                Currency = item.Symbol,
                Price = item.Price,
                Name = item.Name,
                Description = item.Description
            }));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> RewardSlot(RewardSlotModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Items = await PaytopiaReader.GetRewardSlotItems();

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

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

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

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

            return(CloseModal(result));
        }