//post request to add airport public async Task <HttpResponseMessage> PostAsync(Airport airport) { List <Airport> airports = await sqlDbHelper.GetAirports(); // to check if there's an existing airport with the same code if (airports.Find(a => a.Code == airport.Code) == null) { // in case it does not exist a ok status code and created message are returned await sqlDbHelper.AddAirport(airport); return(Request.CreateResponse(HttpStatusCode.OK, "Created")); } else { // in case it does, an ok status code and cannoted be created message are returned return(Request.CreateResponse(HttpStatusCode.OK, "Cannot be created!")); } }