Example #1
0
 public void ChangeLot(Lot NewData)
 {
     try
     {
         DataBase.Edit(NewData.Product);
         DataBase.Edit(NewData);
         var photos = DataBase.GetAllProductPhotoById(NewData.Product.Id);
         foreach (var item in NewData.Product.Photos)
         {
             if (!photos.ToList().Contains(item))
             {
                 var id = DataBase.AddData(item);
                 DataBase.AddConnectPhotoToProduct(id, NewData.Product.Id);
             }
         }
         foreach (var item in photos)
         {
             if (!NewData.Product.Photos.Contains(item))
             {
                 DataBase.DeletePhoto(item.Id);
             }
         }
     }
     catch (Exception e)
     {
         Entity.Helpers.Logger.Log.Error("Error ChangeLot " + e.Message);
     }
 }