public async Task <IActionResult> CreateDocument() { DocumentViewModel model = new DocumentViewModel { RequestBy = userId, DocumentTypes = await typeRepository.GetAllDocumentType() }; return(View(model)); }
/// <summary> /// Method to get all the records from the DocumentType table /// </summary> /// <returns> List of records stored in table </returns> public TransactionDTO <List <DocumentTypeDTO> > GetAllDocumentType() { TransactionDTO <List <DocumentTypeDTO> > transaction = new TransactionDTO <List <DocumentTypeDTO> >(); transaction.Data = new List <DocumentTypeDTO>(); try { var getDocumentType = _documentTypeRepository.GetAllDocumentType(); if (getDocumentType == null || getDocumentType.Count == 0) { transaction.Status = Common.Status.Failure; transaction.Message = "No existen datos en la base de datos para los tipos de documentos."; return(transaction); } foreach (var item in getDocumentType) { DocumentTypeDTO documentTypeDTO = new DocumentTypeDTO(item.Id, item.Name, item.Code); transaction.Data.Add(documentTypeDTO); } } catch (ArgumentException ex) { transaction.Status = Common.Status.Failure; transaction.Message = ex.Message; } return(transaction); }
public ViewResult Index(string txtSearch) { IQueryable <DocumentTypeViewModel> q = DocumentTypeRepository.GetAllDocumentType() .Select(item => new DocumentTypeViewModel { Id = item.Id, CreatedUserId = item.CreatedUserId, //CreatedUserName = item.CreatedUserName, CreatedDate = item.CreatedDate, ModifiedUserId = item.ModifiedUserId, //ModifiedUserName = item.ModifiedUserName, ModifiedDate = item.ModifiedDate, Name = item.Name }).OrderByDescending(m => m.ModifiedDate); ViewBag.SuccessMessage = TempData["SuccessMessage"]; ViewBag.FailedMessage = TempData["FailedMessage"]; ViewBag.AlertMessage = TempData["AlertMessage"]; return(View(q)); }
public List <DocumentType> GetAllDocumentType() { return(_iDocumentTypeRepository.GetAllDocumentType()); }