public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } if (!(AllowedUsers is null)) { Document.AllowedUsers = AllowedUsers.Split(",").ToList().Select(a => a.Trim()).ToArray(); } var test = _context.DocumentAnnotations.AsNoTracking().SingleOrDefault(m => m.DocumentId == Document.DocumentId && m.UserId == User.FindFirst(ClaimTypes.NameIdentifier).Value); if (test is null) { return(NotFound()); } _context.Attach(Document).State = EntityState.Modified; await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Text).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TextExists(Text.TextId)) { return(NotFound()); } throw; } return(RedirectToPage("./Index")); }