public async Task <List <CaseModel> > GetAllCases() { context = new MongoDataContext(); caseRepository = new CaseRepository(context); IEnumerable <Case> cases = await caseRepository.GetAll(); List <CaseModel> caseModel = cases.Select(x => new CaseModel { Id = x.Id, Engagement = x.Engagement, FirstName = x.FirstName, LastName = x.LastName, MiddleName = x.MiddleName, PersonId = x.PersonId, Este = x.Este, status = x.status, TaxModel = x.TaxModel, TaxYear = x.TaxYear, ExternalDocuments = x.ExternalDocuments, OrganizerPDF = x.organizerPDF, OrganizerXML = x.organizerXML, UploadedDocumentsWithOCR = x.UploadedDocumentsWithOCR, UploadedDocumentsWithoutOCR = x.UploadedDocumentsWithoutOCR }).ToList(); return(caseModel); }
public void InitDB() { if (CaseRepository.GetAll().Count() == 0) { CaseRepository.Insert(new Case() { Caseid = 1, Name = "Все" }); CaseRepository.Insert(new Case() { Caseid = 2, Name = "Уголовное" }); CaseRepository.Insert(new Case() { Caseid = 3, Name = "Гражданское" }); CaseRepository.Insert(new Case() { Caseid = 4, Name = "Административное" }); CaseRepository.Insert(new Case() { Caseid = 5, Name = "Экономическое" }); CaseRepository.Insert(new Case() { Caseid = 6, Name = "Дисциплинарный спор" }); this.Save(); } if (CourtRepository.GetAll().Count() == 0) { CourtRepository.Insert(new Court() { CourtId = 1, Name = "Все", BaseURL = "none", URLToDoc = "none", TypeSite = "none", TypeSiteId = 0, Encoding = "none" }); CourtRepository.Insert(new Court() { CourtId = 2, Name = "Верховный Суд", BaseURL = "http://www.vsrf.ru", URLToDoc = "indexA.php?", TypeSite = "vsrf", TypeSiteId = 1, Encoding = "windows-1251" }); CourtRepository.Insert(new Court() { CourtId = 3, Name = "Архангельский областной суд", BaseURL = "http://oblsud.arh.sudrf.ru", URLToDoc = "modules.php?", TypeSite = "sudrf", TypeSiteId = 2, Encoding = "windows-1251" }); this.Save(); } if (InstanceRepository.GetAll().Count() == 0) { InstanceRepository.Insert(new Instance() { InstanceId = 1, Name = "Все" }); InstanceRepository.Insert(new Instance() { InstanceId = 2, Name = "Первая инстанция" }); InstanceRepository.Insert(new Instance() { InstanceId = 3, Name = "Апелляция" }); InstanceRepository.Insert(new Instance() { InstanceId = 4, Name = "Кассация" }); InstanceRepository.Insert(new Instance() { InstanceId = 5, Name = "Надзор" }); this.Save(); } if (TypeDocRepository.GetAll().Count() == 0) { TypeDocRepository.Insert(new DocType() { DocTypeId = 1, Name = "Все" }); TypeDocRepository.Insert(new DocType() { DocTypeId = 2, Name = "Решение" }); TypeDocRepository.Insert(new DocType() { DocTypeId = 3, Name = "Приговор" }); TypeDocRepository.Insert(new DocType() { DocTypeId = 4, Name = "Определение" }); TypeDocRepository.Insert(new DocType() { DocTypeId = 5, Name = "Постановление" }); this.Save(); } }