Exemplo n.º 1
0
        // PUT api/person/5
        public HttpResponseMessage POST(Person person)
        {
            person.Id = Person.All.Max(m => m.Id) + 1;
            Person.All.Add(person);
            return Request.CreateResponse(HttpStatusCode.OK, person);

            //return Request.CreateResponse(HttpStatusCode.OK);
        }
Exemplo n.º 2
0
        // POST api/person
        public HttpResponseMessage Put(Person person)
        {
            var p = Person.All.FirstOrDefault(m => m.Id == person.Id);
            p.FirstName = person.FirstName;
            p.LastName = person.LastName;
            p.IsMarried = person.IsMarried;
            p.PhoneNumber = person.PhoneNumber;

            return Request.CreateResponse(HttpStatusCode.OK, person);
        }