private IEnumerable<IssueReplyFeedModel> CreateIssueReplyFeedForAuthority(IEnumerable<IssueReply> anIssueReplys, UserInformationModel<User> aViewingUser, PersonFilter aPersonFilter) { List<IssueReplyFeedModel> myFeedModels = new List<IssueReplyFeedModel>(); foreach (IssueReply myIssueReply in anIssueReplys) { IEnumerable<IssueReplyDisposition> myReplyDisposition = myIssueReply.IssueReplyDispositions; bool myIsAllowed = true; User myUser = myIssueReply.User; IssueReplyFeedModel myFeedModel = new IssueReplyFeedModel(myUser) { IsAnonymous = !myIsAllowed, Id = myIssueReply.Id, DateTimeStamp = TimezoneHelper.ConvertToLocalTimeZone(myIssueReply.DateTimeStamp), State = myIssueReply.State, City = myIssueReply.City, IssueReplyComments = myIssueReply.IssueReplyComments, Issue = myIssueReply.Issue, Reply = myIssueReply.Reply, PersonFilter = aPersonFilter, TotalLikes = (from d in myReplyDisposition where d.Disposition == (int)Disposition.Like select d).Count<IssueReplyDisposition>(), TotalDislikes = (from d in myReplyDisposition where d.Disposition == (int)Disposition.Dislike select d).Count<IssueReplyDisposition>(), HasDisposition = (from d in myReplyDisposition where d.UserId == aViewingUser.Details.Id select d).Count<IssueReplyDisposition>() > 0 ? true : false, TotalComments = myIssueReply.IssueReplyComments.Count }; if (myUser.Id == HAVConstants.PRIVATE_USER_ID) { myFeedModel.DisplayName = myIssueReply.TempFirstName + " " + myIssueReply.TempLastName; } myFeedModels.Add(myFeedModel); } return myFeedModels; }
private IEnumerable<IssueReplyFeedModel> CreateIssueReplyFeed(IEnumerable<IssueReply> anIssueReplys, User aViewingUser, PersonFilter aPersonFilter) { List<IssueReplyFeedModel> myFeedModels = new List<IssueReplyFeedModel>(); foreach (IssueReply myIssueReply in anIssueReplys) { IEnumerable<IssueReplyDisposition> myReplyDisposition = myIssueReply.IssueReplyDispositions; IssueReplyFeedModel myFeedModel = new IssueReplyFeedModel(myIssueReply.User) { Id = myIssueReply.Id, DateTimeStamp = TimezoneHelper.ConvertToLocalTimeZone(myIssueReply.DateTimeStamp), State = myIssueReply.State, City = myIssueReply.City, IssueReplyComments = myIssueReply.IssueReplyComments, Issue = myIssueReply.Issue, Reply = myIssueReply.Reply, PersonFilter = aPersonFilter, TotalLikes = (from d in myReplyDisposition where d.Disposition == (int)Disposition.Like select d).Count<IssueReplyDisposition>(), TotalDislikes = (from d in myReplyDisposition where d.Disposition == (int)Disposition.Dislike select d).Count<IssueReplyDisposition>(), HasDisposition = ((aViewingUser == null) || (from d in myReplyDisposition where d.UserId == aViewingUser.Id select d).Count<IssueReplyDisposition>() > 0) ? true : false, TotalComments = myIssueReply.IssueReplyComments.Count }; myFeedModels.Add(myFeedModel); } return myFeedModels; }