public ActionResult GetChangelog(int versionId, int projectId) { UserContext.Project = ProjectManager.Get(projectId); IssuesFilter filter = null; if (Request.Form.Keys.Count > 0) { filter = new IssuesFilter(); string[] sort = Request.Form[0].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); StringBuilder sortField = new StringBuilder(); StringBuilder sortDirection = new StringBuilder(); for (int i = 0; i < sort.Length; i += 2) { sortField.Append(sort[i]); sortField.Append('|'); sortDirection.Append(sort[i + 1] == "0" ? (int)SortDirection.Ascending : (int)SortDirection.Descending); sortDirection.Append('|'); } filter.SortField = sortField.ToString(); filter.SortOrder = sortDirection.ToString(); filter.ShowSequenced = false; } if (filter == null) { filter = HttpSessionManager.GetFilter(CurrentCard.Id, new IssuesFilter()); filter.ShowSequenced = false; } IEnumerable <Countersoft.Gemini.Commons.Entity.Version> versions = Cache.Versions.GetAll().Where(v => v.ProjectId == projectId && v.Released == true && v.Archived == false).OrderBy(o => o.Sequence); // get all versions that are released or not according to settings passed (BUT - NEVER show archived projects) if (!versions.Any(s => s.Id == versionId)) { VersionDto newVersion = VersionManager.GetFirstChangeLogVersion(UserContext.Project.Entity.Id); if (newVersion != null) { versionId = newVersion.Entity.Id; } else { versionId = versions.Count() > 0 ? versions.First().Id : 0; } } var version = VersionManager.Get(versionId); List <IssueDto> issues = new List <IssueDto>(); if (version != null && version.Entity.Released) { issues = IssueManager.GetRoadmap(UserContext.Project.Entity.Id, filter, versionId); } Changelog.Models.ChangelogpAppModel model = BuildModelData(versionId, versions, filter); model.Issues = issues; return(JsonSuccess(new { success = true, grid = RenderPartialViewToString(this, "~/Views/Shared/DisplayTemplates/IssueDto.cshtml", model), statusBar = RenderPartialViewToString(this, AppManager.Instance.GetAppUrl("20A79C86-9FB4-4160-A4FD-29E37E185673", "views/StatusBar.cshtml"), model), versions = RenderPartialViewToString(this, AppManager.Instance.GetAppUrl("20A79C86-9FB4-4160-A4FD-29E37E185673", "views/VersionProgress.cshtml"), model) })); }