Beispiel #1
0
        public HttpResponseMessage ListPhotoFeed(string userName, decimal conferenceId, int page, int pageSize)
        {
            var model      = new NewFeedModel();
            var photoFeeds = model.getListPhotoFeed(conferenceId, page, pageSize);
            var result     = new List <PhotoResponse>();

            foreach (PhotoFeed item in photoFeeds)
            {
                var itemFeed = new PhotoResponse();
                itemFeed.Date     = item.Date;
                itemFeed.ListFeed = new List <ActivityFeed>();
                foreach (MESSAGE_FEED feed in item.ListFeed)
                {
                    var account = new AccountModel().GetUserByUserName(feed.UserName);
                    var f       = new ActivityFeed();
                    f.MESSAGE_FEED_ID             = feed.MESSAGE_FEED_ID;
                    f.UserName                    = feed.UserName;
                    f.PERSON_ID                   = account.PERSON_ID;
                    f.CURRENT_LAST_NAME           = feed.CURRENT_LAST_NAME;
                    f.CURRENT_MIDDLE_NAME         = feed.CURRENT_MIDDLE_NAME;
                    f.CURRENT_FIRST_NAME          = feed.CURRENT_FIRST_NAME;
                    f.REPLYING_TO_MESSAGE_FEED_ID = feed.REPLYING_TO_MESSAGE_FEED_ID;
                    f.MESSAGE_CONTENT             = feed.MESSAGE_CONTENT;
                    f.ATTACHED_PHOTO_FILENAME     = feed.ATTACHED_PHOTO_FILENAME;
                    f.ATTACHED_PHOTO_NOTE         = feed.ATTACHED_PHOTO_NOTE;
                    f.ATTACHED_PHOTO_LONGITUDE    = feed.ATTACHED_PHOTO_LONGITUDE;
                    f.ATTACHED_PHOTO_LATITUDE     = feed.ATTACHED_PHOTO_LATITUDE;
                    f.Image       = account.Image;
                    f.Time        = DateTimeFormater.GetTimeAgo(feed.FROM_DATE.Value);
                    f.FROM_DATE   = feed.FROM_DATE;
                    f.THRU_DATE   = feed.THRU_DATE;
                    f.ListComment = model.getListActivityFeedComment(feed.MESSAGE_FEED_ID);
                    f.IS_LIKED    = model.checkIsLiked(userName, feed.MESSAGE_FEED_ID);
                    f.ListLike    = model.listLike(feed.MESSAGE_FEED_ID);
                    itemFeed.ListFeed.Add(f);
                }
                result.Add(itemFeed);
            }

            return(ResponseSuccess(StringResource.Success, result));
        }
Beispiel #2
0
        public HttpResponseMessage NewFeedDetail(int MESSAGE_FEED_ID, string userName)
        {
            var account = new AccountModel().GetUserByUserName(userName);

            if (account == null)
            {
                return(ResponseFail(StringResource.Account_does_not_exist));
            }
            else
            {
                var model  = new NewFeedModel();
                var result = db.MESSAGE_FEED.Find(MESSAGE_FEED_ID);
                if (result != null)
                {
                    var activityFeed = new ActivityFeed();
                    activityFeed.MESSAGE_FEED_ID             = result.MESSAGE_FEED_ID;
                    activityFeed.UserName                    = result.UserName;
                    activityFeed.MESSAGE_CONTENT             = result.MESSAGE_CONTENT;
                    activityFeed.CURRENT_LAST_NAME           = result.CURRENT_LAST_NAME;
                    activityFeed.CURRENT_FIRST_NAME          = result.CURRENT_FIRST_NAME;
                    activityFeed.REPLYING_TO_MESSAGE_FEED_ID = result.REPLYING_TO_MESSAGE_FEED_ID;
                    activityFeed.ATTACHED_PHOTO_FILENAME     = result.ATTACHED_PHOTO_FILENAME;
                    activityFeed.ATTACHED_PHOTO_NOTE         = result.ATTACHED_PHOTO_NOTE;
                    activityFeed.ATTACHED_PHOTO_LONGITUDE    = result.ATTACHED_PHOTO_LONGITUDE;
                    activityFeed.ATTACHED_PHOTO_LATITUDE     = result.ATTACHED_PHOTO_LATITUDE;
                    activityFeed.Time        = DateTimeFormater.GetTimeAgo(result.FROM_DATE.Value);
                    activityFeed.Image       = account.Image;
                    activityFeed.FROM_DATE   = result.FROM_DATE;
                    activityFeed.THRU_DATE   = result.THRU_DATE;
                    activityFeed.ListComment = model.getListActivityFeedComment(MESSAGE_FEED_ID);
                    activityFeed.ListLike    = model.listLike(MESSAGE_FEED_ID);
                    activityFeed.IS_LIKED    = model.checkIsLiked(userName, MESSAGE_FEED_ID);
                    return(ResponseSuccess(StringResource.Success, activityFeed));
                }
                else
                {
                    return(ResponseFail(StringResource.Can_not_load_detail));
                }
            }
        }