public async Task <ActionResult> Post([FromBody, Bind("Name, Location, Weather")] API.Models.APIAirport airport) { Logic.Airport air = new Logic.Airport { Name = airport.Name, Location = airport.Location, Weather = airport.Weather }; await iRepo.CreateAirport(air); return(CreatedAtRoute("GetAirport", new { name = air.Name }, air)); }
public async Task <IActionResult> Put([FromBody] API.Models.APIAirport airport) { Logic.Airport air = new Logic.Airport(); air.Name = airport.Name; IEnumerable <Logic.Airport> Lairports = await iRepo.ReadAirportList(air); //Need exception handling here, maybe implement in repo? Logic.Airport newAir = new Logic.Airport { Name = airport.Name, Location = airport.Location, Weather = airport.Weather }; await iRepo.UpdateAirport(newAir); return(Ok()); }