Exemple #1
0
        public IHttpActionResult Get(int id)
        {
            var         deleveryMan = repo.Get(id);
            DeleveryMan b           = deleveryMan;

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

                return(Ok(b));
            }
            else
            {
                return(StatusCode(HttpStatusCode.NotFound));
            }
        }
        public IHttpActionResult Get(int id)
        {
            var deleveryMan = repo.Get(id);

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