public async Task <ActionResult> Index(Guid telemetryKey) { Program program = await this.Work.Programs.GetByTelemetryKey(telemetryKey).ConfigureAwait(false); if (program == null) { return(this.RedirectToAction("Index", "Home")); } ProgramManagementViewModel model = new ProgramManagementViewModel { TelemetryKey = program.TelemetryKey, InstrumentationKey = program.InstrumentationKey, ProgramName = program.Name, ProgramId = program.Id, PrimaryAssemblyName = program.PrimaryAssembly.Name + program.PrimaryAssembly.Extension, ProgramDescription = program.Description, }; model.ProgramDownloadUrl = this.Request.Url.GetLeftPart(UriPartial.Authority) + this.Url.NeutralApiUrl(ProgramsController.Routes.DownloadApp, new { developerName = program.DeveloperTeam.Name, programName = model.ProgramName }); List <ProgramUpdatePackageInfo> packages = await this.Work.UpdatePackages.GetAllPackages(program.Id).ConfigureAwait(false); model.UpdatePackages = Mapper.Map <List <ProgramUpdatePackageInfoDto> >(packages); model.ProgramPackageInfo = Mapper.Map <ProgramPackageInfoDto>(await this.Work.ProgramPackages.GetLatestProgramPackageInfo(program.Id).ConfigureAwait(false)); var publicUpdaters = await this.Work.UpdaterRepository.GetPublicUpdaters().ConfigureAwait(false); model.UpdatersSelectList = new List <SelectListItem>(); foreach (Updater publicUpdater in publicUpdaters) { var item = new SelectListItem() { Text = publicUpdater.InternalName, Value = publicUpdater.PublicId.ToString() }; if (publicUpdater.PublicId == program.Updater.PublicId) { item.Selected = true; } model.UpdatersSelectList.Add(item); if (!model.UpdaterInfo.ContainsKey(publicUpdater.InternalName)) { model.UpdaterInfo.Add(publicUpdater.InternalName, publicUpdater.Description); } } return(this.View("ManageProgram", model)); }
public async Task <IActionResult> Index(int id) { try { var model = new ProgramManagementViewModel() { RootUrl = BaseRootUrl, SelectedGarageId = id, Programs = await _programService.GetPrograms(id) }; return(View(model)); } catch (Exception ex) { ex.ToExceptionless().Submit(); return(BadRequest()); } }
public async Task <IActionResult> GetProgramList(int id) { try { if (id == 0) { throw new ApplicationException("ProgramList - Id should ne be set to 0"); } var model = new ProgramManagementViewModel() { Programs = await _programService.GetPrograms(id) }; return(PartialView("_programs", model)); } catch (Exception ex) { ex.ToExceptionless().Submit(); return(BadRequest()); } }