示例#1
0
        public async Task <ActionResult> FeaturedPoolSlot()
        {
            var item = await PaytopiaReader.GetItem(PaytopiaItemType.FeaturedPool);

            var items = await PaytopiaReader.GetFeaturedPoolSlotItems();

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

            return(View("FeaturedPoolSlotModal", new FeaturedSlotModel
            {
                Items = items,
                Balance = balance?.Available ?? 0,
                Currency = item.Symbol,
                Price = item.Price,
                Name = item.Name,
                Description = item.Description
            }));
        }
示例#2
0
        public async Task <ActionResult> FeaturedPoolSlot(FeaturedSlotModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Items = await PaytopiaReader.GetFeaturedPoolSlotItems();

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

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

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

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

            return(CloseModal(result));
        }