Пример #1
0
        /// <summary>
        /// Обновление списка картинок на вьюхе
        /// </summary>
        private void UpdatePictures()
        {
            Pictures = _picturesManager.Pictures;
            OnPropertyChanged("Pictures");

            if (Pictures != null)
            {
                SelectedItem = Pictures.FirstOrDefault();
            }
        }
Пример #2
0
        private void OnPictureNameChanged(PictureNameChangePayload payload)
        {
            var changedPicture = Pictures.FirstOrDefault(pic => pic.Guid == payload.Guid);

            if (changedPicture != null)
            {
                changedPicture.FullFileName = $"{changedPicture.FolderPath}\\{payload.NewPictureName}{changedPicture.FileExtension}";
            }

            _eventAggregator.GetEvent <PictureNameChangedEvent>().Unsubscribe(OnPictureNameChanged);
        }
Пример #3
0
        public void DetachPicture(Guid pictureId)
        {
            var picture = Pictures.FirstOrDefault(x => x.PictureId.Equals(pictureId));

            if (picture is null)
            {
                throw new NotFoundDomainException("Picture does not exist!");
            }

            Pictures.Remove(picture);

            var @event = new ProductPictureRemovedDomainEvent(Id, picture.PictureId);

            AddDomainEvent(@event);
        }
Пример #4
0
        public void RemovePicture(Guid id)
        {
            if (Pictures == null || Pictures.Any())
            {
                throw SheaftException.NotFound("Cet utilisateur ne contient aucune images.");
            }

            var existingPicture = Pictures.FirstOrDefault(p => p.Id == id);

            if (existingPicture == null)
            {
                throw SheaftException.NotFound("L'image est introuvable.");
            }

            Pictures.Remove(existingPicture);
            PicturesCount = Pictures?.Count ?? 0;
        }
Пример #5
0
 public void DeletePictures(ICollection <int> aPictureIdCollection)
 {
     if (Pictures != null && Pictures.Count > 0)
     {
         if (aPictureIdCollection != null && aPictureIdCollection.Count > 0)
         {
             foreach (var item in aPictureIdCollection)
             {
                 var removeItem = Pictures.FirstOrDefault(p => p.UId == item);
                 if (removeItem != null)
                 {
                     Pictures.Remove(removeItem);
                 }
             }
         }
     }
 }
Пример #6
0
 public void AddOrUpdatePictures(ICollection <Picture> aPictureCollection)
 {
     if (aPictureCollection != null && aPictureCollection.Count > 0)
     {
         foreach (var item in aPictureCollection)
         {
             var existItem = Pictures.FirstOrDefault(p => p.UId == item.UId);
             if (existItem == null)
             {
                 Pictures.Add(item);
             }
             else
             {
                 existItem.Update(item.PictureId, item.UseType);
             }
         }
     }
 }
 Picture FindPicture(PictureId id)
 => Pictures.FirstOrDefault(x => x.Id == id);
Пример #8
0
 public Picture FindPicture(Guid id) => Pictures.FirstOrDefault(x => x.Id == id);
Пример #9
0
 public Picture GetPict(int IdPict)
 {
     return(Pictures.FirstOrDefault(p => p.Id == IdPict));
 }