Beispiel #1
0
        public Person Put(int? id, Person personToUpdate)
        {
            if (!id.HasValue)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest, "No person ID provided");
            }

            personToUpdate.Values = new[] { String.Format("Person #{0} updated", id) };

            return personToUpdate;
        }
Beispiel #2
0
        public Person Patch(int? id, Person resource)
        {
            if (!id.HasValue)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest, "No person ID provided");
            }

            resource.Values = new[] { String.Format("Person #{0} partially updated", id) };

            return resource;
        }
Beispiel #3
0
        public object Post(Person resource)
        {
            resource.Values = new[] { "New person added" };
            resource.TimeStamp = DateTime.Now;

            Context.Response.SetHeader("Location", Context.Request.Url.ToAbsoluteUrl("~/home/index/999"));

            return Result.ObjectWithResponseStatus(resource, HttpStatusCode.Created, "Person #999 created");
        }