/// <summary> /// Changes the user's current project to value provided, also updating the area and iteration and /// redirecting to a new url. /// </summary> public ActionResult ChangeProject(string project, string area, string iteration, string fromUrl) { if (!string.IsNullOrEmpty(project) && project != UserContext.Current.CurrentProject.Name) { UserContext.Current.ChangeCurrentProject(project); } else { if (!string.IsNullOrEmpty(area)) { AreaSummary summary = UserContext.Current.CurrentProject.Areas.FirstOrDefault(a => a.Path == area); UserContext.Current.Settings.AreaName = summary.Name; UserContext.Current.Settings.AreaPath = summary.Path; } if (!string.IsNullOrEmpty(iteration)) { IterationSummary summary = UserContext.Current.CurrentProject.Iterations.FirstOrDefault(i => i.Path == iteration); UserContext.Current.Settings.IterationName = summary.Name; UserContext.Current.Settings.IterationPath = summary.Path; } } // Redirect, however if the fromUrl has the bugs/tasks filter querystrings do not redirect // as this will cause those filter settings to be persisted onto the settings of project we're changing to. if (!string.IsNullOrEmpty(fromUrl)) { Uri uri = new Uri(fromUrl); return(Redirect(uri.AbsolutePath)); } else { return(RedirectToAction("Index")); } }
/// <summary> /// Creates an RSS feed, returning an <see cref="RssActionResult"/> for the list of <see cref="WorkItemSummary"/> objects provided, /// which are filtered using the parameters given. /// </summary> protected ActionResult Rss(IEnumerable <WorkItemSummary> list, string title, string projectName, string areaPath, string iterationPath, string filter) { if (!string.IsNullOrEmpty(areaPath)) { areaPath = HttpUtility.UrlDecode(areaPath); AreaSummary summary = UserContext.Current.CurrentProject.Areas.FirstOrDefault(a => a.Path == areaPath); UserContext.Current.Settings.AreaName = summary.Name; UserContext.Current.Settings.AreaPath = summary.Path; } else if (!string.IsNullOrEmpty(iterationPath)) { areaPath = HttpUtility.UrlDecode(iterationPath); IterationSummary summary = UserContext.Current.CurrentProject.Iterations.FirstOrDefault(i => i.Path == iterationPath); UserContext.Current.Settings.IterationName = summary.Name; UserContext.Current.Settings.IterationPath = summary.Path; } RssActionResult result = new RssActionResult(); result.Feed = GetRssFeed(list, title); return(result); }