Example #1
0
        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));
        }
Example #2
0
        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;
                    }
                }
            }
        }