public async Task <IActionResult> List(Guid?appId, string sort, string appType) { if (appId == null) { return(NotFound()); } List <BranchListDTO> branchList; if (sort == "AddBranchApplication") { branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId && x.IsFromLicense != true)).ToList(); } else { branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId)).ToList(); } if (appType == "TRL") { var branchDlsList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId && x.CreateTds == false && x.CreateDls == false && x.IsFromLicense != true)).ToList(); ViewBag.multiSelectBranchList = new MultiSelectList(branchDlsList, nameof(EnumRecord.Id), nameof(EnumRecord.Name)); ViewBag.Expertise = false; // для появления кнопок доручень var expertise = _entityStateHelper.GetAppStates(appId)[nameof(BaseApplication.PerformerOfExpertise)]; if (!string.IsNullOrEmpty(expertise)) { ViewBag.Expertise = true; } ViewBag.Decision = false; // для появления кнопок доручень var decision = _dataService.GetEntity <TrlApplication>(x => x.Id == appId) .Select(x => x.AppDecisionId)?.SingleOrDefault().ToString(); if (!string.IsNullOrEmpty(decision)) { ViewBag.Decision = true; } } ViewBag.ApplicationId = appId.Value; ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(appId.Value).IsBranch; ViewBag.sort = sort; ViewBag.appState = _entityStateHelper.GetAppStates(appId)[nameof(BaseApplication.BackOfficeAppState)]; ViewBag.appType = appType; branchList.ForEach(dto => dto.isEditable = _entityStateHelper.IsEditableBranch(dto.Id)); switch (sort) { case "RemBranchApplication": branchList.ForEach(x => x.isEditable = _entityStateHelper.GetAppStates(appId)[nameof(BaseApplication.BackOfficeAppState)] == "Project"); return(PartialView("List_RemBranchApplication", branchList.Where(x => x.RecordState != RecordState.D))); case "ChangeInfoApplication": return(PartialView("List_ChangeInfo", branchList)); default: return(PartialView(branchList)); } }
public async Task <IActionResult> List(Guid?appId, string sort) { if (appId == null) { return(NotFound()); } List <BranchListDTO> branchList; if (sort == "AddBranchApplication") { branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId && x.IsFromLicense != true)).ToList(); } else { branchList = (await _dataService.GetDtoAsync <BranchListDTO>(x => x.ApplicationId == appId)).ToList(); } ViewBag.ApplicationId = appId.Value; ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(appId.Value).IsBranch; ViewBag.sort = sort; branchList.ForEach(dto => dto.isEditable = _entityStateHelper.IsEditableBranch(dto.Id)); switch (sort) { case "RemBranchApplication": return(PartialView("List_RemBranchApplication", branchList.Where(x => x.RecordState != RecordState.D))); case "ChangeInfoApplication": return(PartialView("List_ChangeInfo", branchList)); default: return(PartialView(branchList)); } }