} //End LoadDMDataValues private UserCollectionData LoadUserCollections(long photoID) { Phocalstream_Shared.Data.Model.Photo.User User = UserRepository.First(u => u.ProviderID == this.User.Identity.Name); if (User != null) { UserCollectionData model = new UserCollectionData(); model.PhotoID = photoID; List <UserCollection> userCollections = new List <UserCollection>(); IEnumerable <Collection> collections = CollectionRepository.Find(c => c.Owner.ID == User.ID && c.Site == null && c.Type != CollectionType.TIMELAPSE, c => c.Photos); foreach (var col in collections) { UserCollection userCollection = new UserCollection(); userCollection.CollectionID = col.ID; userCollection.CollectionName = col.Name; userCollection.Added = col.Photos.Select(p => p.ID).Contains(photoID); userCollections.Add(userCollection); } model.Collections = userCollections; return(model); } else { return(null); } }
public ActionResult TogglePhotoInUserCollection(long photoID, long collectionID) { CollectionService.TogglePhotoInUserCollection(photoID, collectionID); UserCollectionData model = LoadUserCollections(photoID); return(PartialView("_UserCollectionPartial", model)); }
public ActionResult NewUserCollection(string collectionName, long photoID) { User user = UserRepository.First(u => u.ProviderID == this.User.Identity.Name); CollectionService.NewUserCollection(user, collectionName, Convert.ToString(photoID)); UserCollectionData model = LoadUserCollections(photoID); return(PartialView("_UserCollectionPartial", model)); }