Exemplo n.º 1
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            DocumentMapping.Map(modelBuilder.Entity <Document>());
            DocumentTypeMapping.Map(modelBuilder.Entity <DocumentType>());
        }
Exemplo n.º 2
0
        public async Task <List <DocumentDto> > GetDocuments()
        {
            var documents = await _context.Documents
                            .OrderBy(n => n.Name)
                            .ToListAsync();

            var documentMapping = new DocumentMapping();
            var documentDtos    = new List <DocumentDto>();

            foreach (var document in documents)
            {
                documentDtos.Add(documentMapping.Map(document));
            }

            //returns an empty list when nothing is found.
            return(documentDtos);
        }