public Traveler Add(Traveler item) { if (item == null) { throw new ArgumentNullException("item"); } else { context.Travelers.Add(item); context.SaveChanges(); RefreshTravelerList(); return item; } }
public HttpResponseMessage PostTraveler(Traveler newTraveler) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } else { newTraveler = repo.Add(newTraveler); var response = Request.CreateResponse(HttpStatusCode.Created, newTraveler); return response; } }