Example #1
0
        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);
        }
Example #2
0
 public void PrintUserProfile(CarSeat seats)
 {
     Console.WriteLine("Email: " + Email);
     foreach (CarSeat s in CarSeats)
     {
         seats.PrintCarSeat();
     }
 }
Example #3
0
 /// <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);
 }