示例#1
0
        public async Task <IActionResult> OnGetAsync(string documentid)
        {
            if (String.IsNullOrEmpty(documentid))
            {
                return(new NotFoundResult());
            }
            ReferencedCalenderItem = await _calendarRepository.GetDocument(documentid);

            CalendarItemId = ReferencedCalenderItem.Id;
            if (ReferencedCalenderItem == null)
            {
                return(new NotFoundResult());
            }
            if (ReferencedCalenderItem.Members != null)
            {
                RegisteredUsers.AddRange(ReferencedCalenderItem.Members);
            }
            if (ReferencedCalenderItem.RegistrationKeys != null)
            {
                RegistrationKeys.AddRange(ReferencedCalenderItem.RegistrationKeys);
            }
            Random randomGen = new Random();

            NewRegistrationKey = new RegistrationKey {
                UniqueId = Guid.NewGuid().ToString(), Key = randomGen.Next(1000, 1000000).ToString()
            };
            return(Page());
        }
示例#2
0
        public async Task <IActionResult> OnGetDeleteRegistrationKeyAsync(string documentid, string registrationkeyid)
        {
            if (String.IsNullOrEmpty(documentid))
            {
                return(new NotFoundResult());
            }
            ReferencedCalenderItem = await _calendarRepository.GetDocument(documentid);

            if (ReferencedCalenderItem == null || ReferencedCalenderItem.RegistrationKeys == null)
            {
                return(new NotFoundResult());
            }
            RegistrationKeys.AddRange(ReferencedCalenderItem.RegistrationKeys);
            RegistrationKeys.RemoveAll(m => m.UniqueId == registrationkeyid);
            ReferencedCalenderItem.RegistrationKeys = RegistrationKeys.ToArray();
            await _calendarRepository.UpsertDocument(ReferencedCalenderItem);

            return(RedirectToPage(new { documentid = ReferencedCalenderItem.Id }));
        }