public static List <UserProfile> ConvertJsonToProfile(UserProfile data) { var profiles = new List <UserProfile>(); foreach (UserProfile s in profiles) { UserProfile profile = new UserProfile() { Email = s.Email, FirstName = s.FirstName, LastName = s.LastName, Password = s.Password }; foreach (CarSeat seat in s.CarSeats) { CarSeat car_seat = new CarSeat() { SerialNumber = seat.SerialNumber, Make = seat.Make, Model = seat.Model }; car_seat.SetGPSLocation(seat.Latitude, seat.Longitude); car_seat.SetTemperature(seat.Temperature, seat.TemperatureUnit); car_seat.SetWeight(seat.Weight, seat.WeightUnit); profile.AddCarSeat(car_seat); } profiles.Add(profile); } return(profiles); }
public void PrintUserProfile(CarSeat seats) { Console.WriteLine("Email: " + Email); foreach (CarSeat s in CarSeats) { seats.PrintCarSeat(); } }
/// <summary> /// Adds Unique CarSeat to Profile /// </summary> /// <param name="seat"></param> /// <returns>bool indicating addition was successful</returns> public bool AddCarSeat(CarSeat seat) { if (!this.CarSeats.Contains(seat, carSeatComparer)) { this.CarSeats.Add(seat); return(true); } return(false); }