public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Bookmark = await _bookmarksManager.Read((int)id); if (Bookmark == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Bookmark = await _bookmarksManager.Read((int)id); if (Bookmark == null) { return(NotFound()); } var currentUserId = Guid.Parse(User.Claims.Where(c => c.Type == ClaimTypes.NameIdentifier).FirstOrDefault().Value); if (Bookmark.OwnerId != currentUserId) { ErrorMessage = "You are not allowed to delete this bookmark."; return(RedirectToPage("/Index")); } return(Page()); }
public IActionResult OnGet(int?id) { if (id == null) { return(NotFound()); } Bookmark = _bookmarksManager.Read((int)id).Result; if (Bookmark == null) { return(NotFound()); } UserList = _userManager.Users.Select(u => new SelectListItem { Value = u.Id.ToString(), Text = u.UserName }).OrderBy(u => u.Text).ToList(); return(Page()); }
public IActionResult OnGet(int?id) { if (id == null) { return(NotFound()); } Bookmark = _bookmarksManager.Read((int)id).Result; var currentUserId = Guid.Parse(User.Claims.Where(c => c.Type == ClaimTypes.NameIdentifier).FirstOrDefault().Value); if (Bookmark.OwnerId != currentUserId) { ErrorMessage = "You are not allowed to see this bookmark."; return(Unauthorized()); } if (Bookmark == null) { return(NotFound()); } return(Page()); }