// // GET: /Platform/ public ActionResult Index(string id) { string platform = id; Models.PlatformViewModel mdl = new Models.PlatformViewModel(); mdl.CurrentPlatform = platform; using (var context = new Repository.BetaDepotContext()) { if (platform != null) { string userName = User.Identity.GetUserName(); List<Repository.ApplicationTeamMember> membershipList = context.ApplicationTeamMembers .Where(wt => wt.TeamMember.UserName == userName).ToList(); var apps = (from a in context.Applications join tm in context.ApplicationTeamMembers on a.Id equals tm.ApplicationId where tm.TeamMember.UserName == userName select a).ToList(); //List<Repository.Application> apps = context.Applications.Where(w => // w.AssignedMembers.Contains( // context.ApplicationTeamMembers.Where(wt => wt.TeamMember.UserName.ToLower() == userName.ToLower()).FirstOrDefault()) // && w.Platform.ToLower() == platform.ToLower() // ).ToList(); foreach(Repository.Application a in apps) { List<Repository.ApplicationBuild> latestBuilds = Repository.Managers.ApplicationBuildMgr.GetLastestBuildsByApplicationAndPlatform(a.Id, platform); foreach(Repository.ApplicationBuild b in latestBuilds) { mdl.Applications.Add(new Models.PlatformViewModel.PlatformBuildDetail() { AppId = a.Id, AppName = a.Name, Environment = b.Environment.EnvironmentName, AppIconUrl = Platforms.Common.GenerateAppIconUrl(a.ApplicationIdentifier), InstallUrl = Platforms.Common.GeneratePackageInstallUrl("App", "Download", a.Platform, b.UniqueIdentifier.ToString()), Platform = platform, UploadedByName = String.Format("{0} {1}", b.AddedBy.FirstName, b.AddedBy.LastName), UploadedDtm = Common.Functions.GetPrettyDate(b.AddedDtm.ToLocalTime(), "MM/dd/yy"), BuildNotes = b.Notes, BuildId = b.Id, VersionNumber = b.versionNumber }); } } } } return View(mdl); }
// // GET: /Platform/ public ActionResult Index(string id) { string platform = id; Models.PlatformViewModel mdl = new Models.PlatformViewModel(); mdl.CurrentPlatform = platform; using (var context = new Repository.BetaDepotContext()) { if (platform != null) { string userName = User.Identity.GetUserName(); List <Repository.ApplicationTeamMember> membershipList = context.ApplicationTeamMembers .Where(wt => wt.TeamMember.UserName == userName).ToList(); var apps = (from a in context.Applications join tm in context.ApplicationTeamMembers on a.Id equals tm.ApplicationId where tm.TeamMember.UserName == userName select a).ToList(); //List<Repository.Application> apps = context.Applications.Where(w => // w.AssignedMembers.Contains( // context.ApplicationTeamMembers.Where(wt => wt.TeamMember.UserName.ToLower() == userName.ToLower()).FirstOrDefault()) // && w.Platform.ToLower() == platform.ToLower() // ).ToList(); foreach (Repository.Application a in apps) { List <Repository.ApplicationBuild> latestBuilds = Repository.Managers.ApplicationBuildMgr.GetLastestBuildsByApplicationAndPlatform(a.Id, platform); foreach (Repository.ApplicationBuild b in latestBuilds) { mdl.Applications.Add(new Models.PlatformViewModel.PlatformBuildDetail() { AppId = a.Id, AppName = a.Name, Environment = b.Environment.EnvironmentName, AppIconUrl = Platforms.Common.GenerateAppIconUrl(a.ApplicationIdentifier), InstallUrl = Platforms.Common.GeneratePackageInstallUrl("App", "Download", a.Platform, b.UniqueIdentifier.ToString()), Platform = platform, UploadedByName = String.Format("{0} {1}", b.AddedBy.FirstName, b.AddedBy.LastName), UploadedDtm = Common.Functions.GetPrettyDate(b.AddedDtm.ToLocalTime(), "MM/dd/yy"), BuildNotes = b.Notes, BuildId = b.Id, VersionNumber = b.versionNumber }); } } } } return(View(mdl)); }