예제 #1
0
        public async Task <IActionResult> DownloadMyMasterQrCodeAsync(Guid eventId)
        {
            Guid         userId       = User.GetUserId();
            MasterQrCode masterQrCode = await _context.MasterQrCodes
                                        .Where(e => e.EventId == eventId &&
                                               e.OwnerId == userId &&
                                               e.RevokedAt == null)
                                        .FirstOrDefaultAsync();

            if (masterQrCode == null)
            {
                masterQrCode = new MasterQrCode
                {
                    EventId   = eventId,
                    OwnerId   = userId,
                    CreatedAt = DateTime.UtcNow
                };
                _context.Add(masterQrCode);
                await _context.SaveChangesAsync();
            }

            string loginUrl = Url.ActionAbsoluteUrl <MasterQrCodeLoginController>(
                nameof(MasterQrCodeLoginController.LoginAsync),
                new { token = masterQrCode.Id.ToString() });

            return(new QrCodeResult(loginUrl));
        }
예제 #2
0
 /// <summary>
 /// Build the URI to validate a ticket at entrance control.
 /// </summary>
 protected string GetTicketValidationUri(string secret)
 {
     return(Url.ActionAbsoluteUrl <TicketValidationController>(
                nameof(TicketValidationController.ValidateTicketByQrCodeValueAsync),
                new { secret = secret }));
 }