public void UpdateAircraft(Guid aircraftId, AircraftFormUpdate aircraftFormUpdate) { AircraftEntity aircrafEntity = _context.Aircrafts.SingleOrDefault(a => a.Id == aircraftId); // Mapper.Map(Source, Dest), It converts the data from AircraftFormUpdate into AircraftEntity // by Overriding the fields. After all it is required is to save changes _mapper.Map(aircraftFormUpdate, aircrafEntity); _context.SaveChanges(); }
public IActionResult UpdateAircraft(Guid aircraftId, [FromBody] AircraftFormUpdate aircraftForm) { _aircraftService.UpdateAircraft(aircraftId, aircraftForm); return(NoContent()); }