public ActionResult BuildHistory(string Platform, int id, string environment) { Models.PlatformViewAppBuildHistory mdl = new Models.PlatformViewAppBuildHistory(); if (!Repository.Managers.ApplicationBuildMgr.IsUserAnAppTeamMember(User.Identity.GetUserName(), id)) { throw new HttpException(403, "You are not a team member of this app."); } string currentUser = User.Identity.GetUserName().ToLower(); using (var context = new BetaDepot.Repository.BetaDepotContext()) { Repository.Application app = context.Applications.Where(wa => wa.Id == id).FirstOrDefault(); mdl.CurrentUsersMembershipRole = context.ApplicationTeamMembers .Where(w => w.TeamMember.UserName.ToLower() == currentUser && w.ApplicationId == id).FirstOrDefault().MemberRole; List <Repository.ApplicationBuild> builds = context.Builds .Where(w => w.Application.Id == id && (environment == null || w.Environment.EnvironmentName == environment)) .OrderByDescending(o => o.AddedDtm) .ToList(); mdl.AppIconUrl = Platforms.Common.GenerateAppIconUrl(app.ApplicationIdentifier); mdl.AppId = id; mdl.AppName = app.Name; mdl.Platform = app.Platform; mdl.selectedEnvironment = environment ?? string.Empty; builds.ForEach(f => { mdl.Builds.Add(new Models.PlatformViewAppBuildHistory.BuildHistory() { BuildId = f.Id, BuildNotes = f.Notes, Environment = f.Environment.EnvironmentName, UploadedByName = String.Format("{0} {1}", f.AddedBy.FirstName, f.AddedBy.LastName), UploadedDtm = Common.Functions.GetPrettyDate(f.AddedDtm.ToLocalTime(), "MM/dd/yy"), VersionNumber = string.IsNullOrEmpty(f.versionCode) ? f.versionNumber : string.Format("{0} ({1})", f.versionNumber, f.versionCode), InstallUrl = Platforms.Common.GeneratePackageInstallUrl("App", "Download", f.Platform, f.UniqueIdentifier.ToString()), Platform = f.Platform }); }); } return(View(mdl)); }
public ActionResult BuildHistory(string Platform, int id, string environment) { Models.PlatformViewAppBuildHistory mdl = new Models.PlatformViewAppBuildHistory(); if (!Repository.Managers.ApplicationBuildMgr.IsUserAnAppTeamMember(User.Identity.GetUserName(), id)) throw new HttpException(403, "You are not a team member of this app."); string currentUser = User.Identity.GetUserName().ToLower(); using(var context = new BetaDepot.Repository.BetaDepotContext()) { Repository.Application app = context.Applications.Where(wa => wa.Id == id).FirstOrDefault(); mdl.CurrentUsersMembershipRole = context.ApplicationTeamMembers .Where(w => w.TeamMember.UserName.ToLower() == currentUser && w.ApplicationId == id).FirstOrDefault().MemberRole; List<Repository.ApplicationBuild> builds = context.Builds .Where(w => w.Application.Id == id && (environment == null || w.Environment.EnvironmentName == environment)) .OrderByDescending(o => o.AddedDtm) .ToList(); mdl.AppIconUrl = Platforms.Common.GenerateAppIconUrl(app.ApplicationIdentifier); mdl.AppId = id; mdl.AppName = app.Name; mdl.Platform = app.Platform; mdl.selectedEnvironment = environment ?? string.Empty; builds.ForEach(f => { mdl.Builds.Add(new Models.PlatformViewAppBuildHistory.BuildHistory() { BuildId = f.Id, BuildNotes = f.Notes, Environment = f.Environment.EnvironmentName, UploadedByName = String.Format("{0} {1}", f.AddedBy.FirstName, f.AddedBy.LastName), UploadedDtm = Common.Functions.GetPrettyDate(f.AddedDtm.ToLocalTime(), "MM/dd/yy"), VersionNumber = string.IsNullOrEmpty(f.versionCode) ? f.versionNumber : string.Format("{0} ({1})", f.versionNumber, f.versionCode), InstallUrl = Platforms.Common.GeneratePackageInstallUrl("App", "Download", f.Platform, f.UniqueIdentifier.ToString()), Platform = f.Platform }); }); } return View(mdl); }