// PUT /person/1
        public void Put(Person person)
        {
            if (_personRepository.Get(person.Id) == null)
                throw new HttpResponseException(HttpStatusCode.NotFound);

            _personRepository.Update(person);
        }
 public void Update(Person person)
 {
     var index = _people.IndexOf(_people.Single(p => p.Id == person.Id));
     _people[index] = person;
 }
 // POST /person
 public HttpResponseMessage Post(Person person)
 {
     _personRepository.Insert(person);
     return Request.CreateResponse(HttpStatusCode.Created, person);
 }
 public void Insert(Person person)
 {
     person.Id = _people.Count == 0 ? 1 : _people.Max(p => p.Id) + 1;
     _people.Add(person);
 }