public virtual Car CarEdit(CarUpdateDto updatedCar) { Id = updatedCar.Id; Name = updatedCar.Name; AdditionalInfo = updatedCar.AdditionalInfo; Engine.UpdateEngineInfo(Engine, updatedCar.Engine); OwnerPilot = updatedCar.Pilot; FuelTank = updatedCar.TankVolume; Weight = updatedCar.Weight; return this; }
public void UpdateCarInfo(Car oldCar, CarUpdateDto newCar) { using (var tran = _session.BeginTransaction()) { try { var edited = oldCar.CarEdit(newCar); _session.SaveOrUpdate(edited); tran.Commit(); } catch (Exception ex) { tran.Rollback(); Console.WriteLine(ex.Message + "\n" + ex.StackTrace); Logger.AddMsgToLog(ex.Message + "\n" + ex.StackTrace); } } }