public TransactionObject ToggleFavPost(int ID, int userID) { TransactionObject response = new TransactionObject(); try { Post favPost = postManager.GetPost(ID); User currentUser = userManager.GetUser(userID); FavouriteFeeds ff = currentUser.FavouriteFeeds; if (ff == null) { ff = new FavouriteFeeds(); ff.User = currentUser; currentUser.FavouriteFeeds = ff; favFeedManager.AddFavouriteFeed(ff); } if (CheckExistence(ff.FavouritePosts, favPost)) { ff.FavouritePosts.Remove(favPost); favPost.FavouriteFeeds.Remove(ff); favPost.FavouritedCount--; } else { ff.FavouritePosts.Add(favPost); favPost.FavouriteFeeds.Add(ff); favPost.FavouritedCount++; } uow.Save(); response.IsSuccess = true; } catch (Exception ex) { response.IsSuccess = false; response.Explanation = base.GetExceptionMessage(ex); } return(response); }
public void DeleteFavouriteFeed(FavouriteFeeds favFeed) { favFeedRepository.Delete(favFeed); }
public void EditFavouriteFeed(FavouriteFeeds favFeed) { //favFeedRepository.Update(favFeed); }
public void AddFavouriteFeed(FavouriteFeeds favFeed) { favFeedRepository.Add(favFeed); }