public GetDocumentTypeResponse GetDocTypes() { string oradb = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; OracleConnection conn = new OracleConnection(oradb); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select * from documenttype"; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); GetDocumentTypeResponse response = new GetDocumentTypeResponse(); response.DocumentTypes = new List <DocumentType>(); while (dr.HasRows && dr.Read()) { int id; Int32.TryParse(dr[0].ToString(), out id); DocumentType docType = new DocumentType { ID = id, DocumentTypeTitle = dr[1].ToString() }; response.DocumentTypes.Add(docType); } conn.Dispose(); return(response); }
public async Task <IActionResult> GetDocumentType(long documentTypeId) { var getDocumentTypeResponse = new GetDocumentTypeResponse(); var queryHandlerResponse = await _documentTypeMediator.Send(new GetDocumentTypeRequest { DocumentTypeId = documentTypeId }); getDocumentTypeResponse.HandleSuccess(queryHandlerResponse); return(Ok(getDocumentTypeResponse)); }
public GetDocumentTypeResponse GetDocTypes() { GetDocumentTypeResponse response = new GetDocumentTypeResponse(); using (var client = new EchoCollectionClient()) { response = client.GetDocTypes(); } return(response); }