Пример #1
0
        public IHttpActionResult Get(int id)
        {
            var         sellPosting = repo.Get(id);
            SellPosting s           = sellPosting;

            if (sellPosting != null)
            {
                s.Links.Add(new Links()
                {
                    HRef = "http://localhost:62832/api/SellPostings", Method = "GET", Rel = "Get all the user list"
                });
                s.Links.Add(new Links()
                {
                    HRef = "http://localhost:62832/api/SellPostings", Method = "POST", Rel = "Create a new user resource"
                });
                s.Links.Add(new Links()
                {
                    HRef = "http://localhost:62832/api/SellPostings/" + s.SellId, Method = "PUT", Rel = "Modify an existing user resource"
                });
                s.Links.Add(new Links()
                {
                    HRef = "http://localhost:62832/api/SellPostings/" + s.SellId, Method = "DELETE", Rel = "Delete an existing user resource"
                });



                return(Ok(sellPosting));
            }
            else
            {
                return(StatusCode(HttpStatusCode.NotFound));
            }
        }
Пример #2
0
        public IHttpActionResult Get(int id)
        {
            var sellPosting = repo.Get(id);

            if (sellPosting != null)
            {
                return(Ok(sellPosting));
            }
            else
            {
                return(StatusCode(HttpStatusCode.NotFound));
            }
        }