예제 #1
0
        public static FollowViewModel ConvertToFollow(Follow fol)
        {
            var followViewModel = new FollowViewModel
            {
                PubId = fol.Publisher_Id,
                SubId = fol.Subscriber_Id
            };

            return followViewModel;
        }
예제 #2
0
        public bool Add(int publisherId, int subscriberId)
        {
            bool result = false;

            var follow = new Follow
            {
                Publisher_Id = publisherId,
                Subscriber_Id = subscriberId,
                User = user.GetById(publisherId),
                User1 = user.GetById(subscriberId)
            };

            using (var context = new TwitterEntities())
            {
                context.Follows.Attach(follow);
                context.Follows.Add(follow);

                result = context.SaveChanges() > 0;
                Logger.Log.Debug("A new follow pair created with publisherId " + follow.Publisher_Id + " and subscriberId " + follow.Subscriber_Id);
            }
            return result;
        }