Пример #1
0
 public void PopulateNew(ICarRepo repo)
 {
     foreach (var car in repo.GetAllNew())
     {
         bool add = true;
         foreach (var cars in NewCars)
         {
             if (car.Model.ModelId == cars.TotalCar.Model.ModelId)
             {
                 cars.Total++;
                 cars.TotalPrice += car.Price;
                 add              = false;
             }
         }
         if (add)
         {
             var toAdd = new InventoryTotalsVM
             {
                 TotalCar   = car,
                 Total      = 1,
                 TotalPrice = car.Price,
             };
             NewCars.Add(toAdd);
         }
     }
 }