public void Subscribe(User follower, User followee) { ContentContext.DbSet<Subscription>().Add(new Subscription { Follower = follower, Followee = followee }); ContentContext.SaveChanges(); }
public void CreateMessage(User user, string text, IDateTimeHelper dateTime) { ContentContext.DbSet<Message>().Add(new Message { Text = text, CreatedBy = user, CreatedDate = dateTime.CurrentDateTime }); ContentContext.SaveChanges(); }
public User CreateUser(string name) { var user = new User { Name = name }; ContentContext.DbSet<User>().Add(user); ContentContext.SaveChanges(); return user; }
public IEnumerable<Message> GetMessages(User user) { return ContentContext.DbSet<Message>().Where(m => m.CreatedBy == user); }
public IEnumerable<User> GetSubscribers(User user) { return ContentContext.DbSet<Subscription>().Where(s => s.Follower == user).Select(s => s.Followee); }