public RESTAPIIdeaStatusInterchange(Idea idea) { if (idea != null) { IdeaId = idea.IdeaId; Username = string.Concat(idea.User.FirstName, idea.User.LastName); Title = idea.Title; Description = idea.Description; Status = ideaUtils.getStatus(idea); IsAttachment = idea.IsAttachment; AttachmentCount = idea.AttachmentCount; CreatedDate = idea.CreatedDate.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"); ModifiedDate = idea.ModifiedDate?.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"); CategoryName = idea.IdeaCategory.CategoriesName; BusinessImpact = idea.BusinessImpact; ApprovalStatus = ideaUtils.GetIdeaState(idea); ChallengeId = idea.ChallengeId; Solution = idea.Solution; GitRepo = idea.GitRepo; if (idea.IdeaChallenge != null) { ChallengeName = idea.IdeaChallenge.ChallengeName; } TotalFollowers = Convert.ToInt32(idea.IdeaSubscribers.FirstOrDefault(x => x.IdeaId == idea.IdeaId)?.TotalFollowers); IsBookmarked = idea.IdeaSubscribers.FirstOrDefault(x => x.IdeaId == idea.IdeaId)?.IsBookmarked; CommentsCount = idea.IdeaComments.Where(x => x.IdeaId == idea.IdeaId).Count(); Rating = Convert.ToInt32(idea.IdeaSubscribers.FirstOrDefault(x => x.IdeaId == idea.IdeaId)?.TotalRating); if (idea.IsAttachment == true) { var ret = idea.IdeaAttachments; if (ret != null) { if (ret != null) { bool IsValue = ret.Any(a => a.FolderName == (folderNames.DefaultImage.ToString())); if (IsValue) { Image = IdeaUtils.getImagePath(idea); } else { Image = IdeaUtils.getDefaultImagePath(); } } } } else { Image = IdeaUtils.getDefaultImagePath(); } } }
public RESTAPIIdeaDetailsInterchange(Idea idea) { if (idea != null) { IdeaId = idea.IdeaId; Username = string.Concat(idea.User.FirstName, " ", idea.User.LastName); Title = idea.Title; Description = idea.Description; Status = ideaUtils.getStatus(idea); IsAttachment = idea.IsAttachment; CreatedDate = idea.CreatedDate.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"); ModifiedDate = idea.ModifiedDate?.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"); CategoryName = idea.IdeaCategory.CategoriesName; BusinessImpact = idea.BusinessImpact; IsSensitive = idea.IsSensitive; ChallengeId = idea.ChallengeId; Solution = idea.Solution; GitRepo = idea.GitRepo; EmailAddress = idea.User.EmailAddress; CategoryId = idea.CategoryId; IsDraft = idea.IsDraft; TotalFollowers = Convert.ToInt32(idea.IdeaSubscribers.FirstOrDefault(x => x.IdeaId == idea.IdeaId)?.TotalFollowers); IsBookmarked = idea.IdeaSubscribers.FirstOrDefault(x => x.IdeaId == idea.IdeaId)?.IsBookmarked == true ? true : false; CommentsCount = idea.IdeaComments.Where(x => x.IdeaId == idea.IdeaId).Count(); Rating = Convert.ToInt32(idea.IdeaSubscribers.FirstOrDefault(x => x.IdeaId == idea.IdeaId)?.TotalRating); ApprovalStatus = ideaUtils.GetIdeaState(idea); int count = idea.IdeaAttachments.Where(x => x.FolderName != Enum.GetName(typeof(folderNames), folderNames.DefaultImage)).Count(); AttachmentCount = count == 0 ? 0 : count; if (idea.IdeaChallenge != null) { ChallengeName = idea.IdeaChallenge.ChallengeName; } TagList = new List <string>(); ReviewersList = new List <RESTAPIIdeaReviewerInterchange>(); SponsorsList = new List <RESTAPIIdeaReviewerInterchange>(); AttachmentsList = new List <RESTAPIIdeaAttachmentInterchange>(); IntellectualList = new List <RESTAPIIntellectualInterchange>(); ContributorList = new List <RESTAPIIdeaContributorInterchange>(); if (idea.IsAttachment == true) { var ret = idea.IdeaAttachments; if (ret != null) { if (ret != null) { bool IsValue = ret.Any(a => a.FolderName == (folderNames.DefaultImage.ToString())); if (IsValue) { Image = IdeaUtils.getImagePath(idea); } else { Image = IdeaUtils.getDefaultImagePath(); } } } } else { Image = IdeaUtils.getDefaultImagePath(); } } }