Exemplo n.º 1
0
        public async Task <IActionResult> Resell()
        {
            ViewData["Message"] = "Resell Ticket";
            var user = await userManager.GetUserAsync(User);

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{userManager.GetUserId(User)}'.");
            }

            string ownerId = user.PublicAddress;

            List <Ticket> tickets = eventRepository.FindTicketByOwnerId(ownerId);
            var           model   = new ResellTicketViewModel
            {
                Tickets = tickets
            };

            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Resell(ResellTicketViewModel model)
        {
            ViewData["Message"] = "Your Tickets";
            var user = await userManager.GetUserAsync(User);

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{userManager.GetUserId(User)}'.");
            }

            var res = await blockchainRepository.ResellTicket(model.TicketId, model.Price, model.Wif);

            if (res != "smth failed")
            {
                model.Link = "https://testnet.qtum.info/tx/" + res;
            }
            string ownerId = user.PublicAddress;

            ViewData["Message"] = res;
            List <Ticket> tickets = eventRepository.FindTicketByOwnerId(ownerId);

            model.Tickets = tickets;
            return(View(model));
        }