public ActionResult SerialActData(Guid?assessmentId) { var assessment = db.OBK_AssessmentDeclaration.FirstOrDefault(o => o.Id == assessmentId); var numberCount = db.OBK_ActReception.Where(o => o.OBK_AssessmentDeclarationId == assessmentId).Count(); ViewData["ContractId"] = assessment.ContractId; ViewData["AttachPath"] = FileHelper.GetObjectPathRoot(); var model = new OBK_ActReception(); model.Id = Guid.NewGuid(); var exp = db.OBK_StageExpDocumentResult.FirstOrDefault(o => o.AssessmetDeclarationId == assessmentId); model.Number = assessment.Number + "-" + (numberCount + 1); model.OBK_AssessmentDeclarationId = assessmentId; var employee = db.Employees.FirstOrDefault(o => o.Id == assessment.EmployeeId); model.Declarer = employee.DisplayName; var product = db.OBK_RS_Products.FirstOrDefault(o => o.ContractId == assessment.ContractId); model.Producer = product.ProducerNameRu; ViewData["ProductSampleList"] = new SelectList(repository.GetProductSamples(), "Id", "Name"); ViewData["InspectionInstalledList"] = new SelectList(repository.GetInspectionInstalls(), "Id", "Name"); ViewData["PackageConditionList"] = new SelectList(repository.GetPackageConditions(), "Id", "Name"); ViewData["StorageConditionsList"] = new SelectList(repository.GetStorageConditions(), "Id", "Name"); ViewData["MarkingList"] = new SelectList(repository.GetMarkings(), "Id", "Name"); ViewData["OBKApplicants"] = new SelectList(repository.OBKApplicants(), "Id", "NameRU"); ViewData["ProductList"] = new SelectList(repository.OBKContractProducts(assessment.ContractId, model.Id), "Id", "DrugFormFullName"); return(PartialView(model)); }