public ActionResult PrimaryPageView(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var expertiseStage = new ExpertiseStageRepository().GetById(id); if (expertiseStage == null) { return(HttpNotFound()); } var primaryRepository = new DrugPrimaryRepository(); var ntd = primaryRepository.GetPrimaryNtdByDeclarationId(expertiseStage.DeclarationId); if (ntd == null) { ntd = new EXP_DrugPrimaryNTD { DrugDeclarationId = expertiseStage.DeclarationId, EXP_DrugDeclaration = expertiseStage.EXP_DrugDeclaration }; } var repository = new ReadOnlyDictionaryRepository(); ViewData["TypeNDList" + expertiseStage.DeclarationId] = new SelectList(repository.GetDicTypeNDs(), "Id", "NameRu", ntd.TypeNDId); ViewData["TypeFileNDList" + expertiseStage.DeclarationId] = new SelectList(repository.GetDicTypeFileNDs(), "Id", "NameRu", ntd.TypeFileNDId); var model = new PrimaryEntity { EXP_DrugPrimaryNTD = ntd, EXP_DrugDeclaration = expertiseStage.EXP_DrugDeclaration, DrugDeclarationId = expertiseStage.DeclarationId.ToString(), Applicant = new EmployeesRepository().GetById(expertiseStage.EXP_DrugDeclaration.OwnerId), Editor = UserHelper.GetCurrentEmployee(), ExpExpertiseStageRemarks = new List <EXP_ExpertiseStageRemark>(), ExpDrugPrimaryKinds = primaryRepository.GetPrimaryKindList(expertiseStage.DeclarationId), ExpeditedType = expertiseStage.EXP_DrugDeclaration.ExpeditedType, ExpStageId = expertiseStage.Id, CurrentStage = new StageModel() { CurrentStage = GetExpertiseStage(expertiseStage.Id), StageResults = repository.GetStageResultsByStage(expertiseStage.StageId) } }; var employeName = ""; if (UserHelper.GetCurrentEmployee() != null) { employeName = UserHelper.GetCurrentEmployee().DisplayName; } ViewBag.CurrentEmployeeName = employeName; var markList = primaryRepository.GetPrimaryMarkList(expertiseStage.DeclarationId, CodeConstManager.STAGE_PRIMARY); var remarkTypes = repository.GetRemarkTypes().ToArray(); ViewData["RemarkTypes" + model.DrugDeclarationId] = new SelectList(remarkTypes, "Id", "NameRu", null); foreach (var expDrugPrimaryRemark in markList) { model.ExpExpertiseStageRemarks.Add(expDrugPrimaryRemark); } foreach (var expDrugPrimaryRemark in model.ExpExpertiseStageRemarks) { ViewData["RemarkTypes" + model.DrugDeclarationId + "_" + expDrugPrimaryRemark.Id] = new SelectList(remarkTypes, "Id", "NameRu", expDrugPrimaryRemark.RemarkTypeId); } model.ExpDrugCorespondences = primaryRepository.GetDrugCorespondences(expertiseStage.DeclarationId); return(PartialView(model)); }