mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
25 lines
1.2 KiB
C#
25 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Marechai.Database.Models;
|
|
using Marechai.ViewModels;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Marechai.Services
|
|
{
|
|
public class DocumentCompaniesService
|
|
{
|
|
readonly MarechaiContext _context;
|
|
|
|
public DocumentCompaniesService(MarechaiContext context) => _context = context;
|
|
|
|
public async Task<List<DocumentCompanyViewModel>> GetAsync() => await _context.
|
|
DocumentCompanies.OrderBy(c => c.Name).
|
|
Select(d => new DocumentCompanyViewModel
|
|
{
|
|
Id = d.Id, Name = d.Name,
|
|
Company = d.Company.Name,
|
|
CompanyId = d.CompanyId
|
|
}).ToListAsync();
|
|
}
|
|
} |