Ejemplo n.º 1
0
        public async Task <List <DocumentTypeDto> > GetDocumentTypes()
        {
            try
            {
                var documentTypes = await _documentTypeRepository.GetAllAsync();

                List <DocumentTypeDto> result = new();
                if (documentTypes != null)
                {
                    foreach (var documentType in documentTypes)
                    {
                        var documentTypeDto = documentType.Adapt(new DocumentTypeDto());
                        result.Add(documentTypeDto);
                    }
                }

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }