public static DbGarage Update(DbGarage garage, GarageDTO dto) { garage.Id = dto.Id; garage.Name = dto.Name; garage.Address = dto.Address; garage.TyreHotel = dto.TyreHotel; garage.TyreSlots = dto.TyreSlots; return(garage); }
public GarageDTO(DbGarage garage) { foreach (var i in typeof(DbGarage).GetProperties()) { var property = typeof(GarageDTO).GetProperty(i.Name); if (property != null) { property.SetValue(this, i.GetValue(garage)); } } this.ServiceLanesList = garage.ServiceLanes?.Where(i => !i.Deleted)?.ToList() ?? new List <DbServiceLine>(); }