public void SubscribeToFeed(Twitter_Shared.Data.Model.User user, Twitter_Shared.Data.Model.Feed feed) { if (user.Subscriptions == null) { user.Subscriptions = new List <Feed>(); } user.Subscriptions.Add(feed); _userRepository.Update(user); }
public PartialViewResult CreateFeed(HomeViewModel model) { // get a user that matches the name of the currently logged in user User user = _userService.FindUserForName(User.Identity.Name); Feed feed = new Feed() { Name = model.NewFeedName, Owner = user }; model.Feeds = _twitterService.AddFeed(feed); _unit.Commit(); model.NewFeedName = ""; ModelState.Clear(); return PartialView("_FeedView", model); }
public List <Twitter_Shared.Data.Model.Feed> AddFeed(Twitter_Shared.Data.Model.Feed feed) { _feedRepository.Insert(feed); return(_userRepository.Refresh(feed.Owner).Feeds.ToList <Feed>()); }