public IActionResult Get(int id) { var link = _linkRepository.GetById(id); var currentUser = GetCurrentUserProfile(); if (link.UserProfileId != currentUser.Id) { return(Unauthorized()); } if (link == null) { return(NotFound()); } return(Ok(link)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.QueryString["Id"] != null) { LinkRepository repo = new LinkRepository(); var toBeEditedLink = repo.GetById(Request.QueryString["Id"].ToSafeInt()); if (toBeEditedLink != null) { txtTitle.Text = toBeEditedLink.Title; txtHref.Text = toBeEditedLink.Href; } } } }