public IActionResult FiledDocuments() { FiledDocumentsViewModel model = new FiledDocumentsViewModel(); var docList = _DocumentService.GetAll(); List <SelectListItem> items = new List <SelectListItem>(); foreach (var doc in docList) { items.Add(new SelectListItem() { Text = doc.DOCUMENT_NAME, Value = doc.DOCUMENT_NAME }); } ViewBag.docs = new SelectList(items, "Text", "Value"); return(View()); }
public IActionResult FiledDocuments(FiledDocumentsViewModel model) { //filter the search results from the query //redirect to results using another view model var allFiledDocs = _FileDocumentService.GetAll(new FileFindWhereParam() { Approved_By_Supervisor_DOD_ID = model.Approved_By_Supervisor_DOD_ID, Document_Type = model.Document_Type, Personnel_DOD_ID = model.Personnel_DOD_ID, Rank = model.Rank }); //foreach result, add to a result card list item in another view model List <SearchResultViewModel> results = new List <SearchResultViewModel>(); foreach (var result in allFiledDocs) { SearchResultViewModel res = new SearchResultViewModel(); res.document_name = result.DOCUMENT_NAME; var owner = _PersonnelService.Get(result.PERSONNEL_OWNER); res.document_owner_name = owner.LAST_NAME + ", " + owner.FIRST_NAME + " " + (String.IsNullOrEmpty(owner.MIDDLE_NAME) ? ' ' : owner.MIDDLE_NAME[0]) + "."; res.Is_Signed = result.IS_SIGNED; res.LinkedPermit = result.PERMIT_GUID; res.filed_document_guid = result.FILLED_DOCUMENT_GUID; results.Add(res); } return(View("Results", results)); }