private Battery ConvertBattery(CustomerCtrServiceReference.Battery battery) { if (battery == null) { return null; } return new Battery { Id = battery.Id, Date = battery.Date, BatteryTypeID = battery.BatteryTypeID, BatteryStationID = battery.BatteryStationID, IsReserved = battery.IsReserved, PercentCharged = battery.PercentCharged, RowVersion = battery.RowVersion, }; }
public ZipCodes ConvertZipCode(CustomerCtrServiceReference.ZipCodes zipCodes) { if (zipCodes == null) { return null; } return new ZipCodes { ZipCode = zipCodes.ZipCode, City = zipCodes.City, }; }
private Reservation ConvertReservation(CustomerCtrServiceReference.Reservation res) { if (res == null) { return null; } return new Reservation { ID = res.ID, Date = res.Date, CustomerID = res.CustomerID, Batteries = ConvertBatteries(res.Batteries), }; }
public Customer ConvertCustomer(CustomerCtrServiceReference.Customer customer) { if (customer == null) { return null; } return new Customer { Id = customer.Id, Name = customer.Name, StreetAddress = customer.StreetAddress, PhoneNr = customer.PhoneNr, ZipCode = ConvertZipCode(customer.ZipCode), BatteryID = customer.BatteryId, //== null ? 0 : customer.Battery.Id, ZipCodeNumber = customer.ZipCodeNumber, Reservations = ConvertReservations(customer.Reservations), RowVersion = customer.RowVersion, Battery = ConvertBattery(customer.Battery), }; }