public void ClearPictures() { if (Pictures == null || Pictures.Any()) { Pictures = new List <ProfilePicture>(); } }
public void AddPicture(Guid pictureId, string pictureUrl) { if (!Pictures.Any(x => x.PictureUrl == pictureUrl)) { Pictures.Add(new ArticlePicture(pictureId, Id, pictureUrl)); } }
public virtual void AddMedia(Guid pictureId) { if (Pictures.Any(x => x.PictureId == pictureId)) { Pictures.RemoveAll(x => x.PictureId == pictureId); } Pictures.Add(new ProductPicture(Id, pictureId)); }
public void AddPicture(string pictureUri, PictureSize size) => Apply( new V1.PictureAddedToAClassifiedAd { PictureId = new Guid(), ClassifiedAdId = Id, OwnerId = OwnerId, Url = pictureUri, Height = size.Height, Width = size.Width, Order = Pictures.Any() ? Pictures.Max(x => x.Order) : 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; }
public void AddPicture(ProductPicture picture) { if (Pictures == null) { Pictures = new List <ProductPicture>(); } if (Pictures.Any(p => p.Position == picture.Position)) { foreach (var productPicture in Pictures.Where(p => p.Position >= picture.Position)) { productPicture.IncreasePosition(); } } Pictures.Add(picture); if (picture.Position == 0) { Picture = picture.Url; } PicturesCount = Pictures.Count; }