public async Task <ActionResult <IEnumerable <ContractDto> > > Get()
 {
     return(await _context.Contracts
            .OrderBy(i => i.CustomerName)
            .Select(i => ContractDto.FromEntity(i))
            .ToListAsync());
 }
        public async Task <ActionResult <ContractDto> > Post(ContractDto dto)
        {
            var entity = await ContractDto.ToEntity(dto, _context);

            if (entity == null)
            {
                return(NotFound());
            }

            await _context.Contracts.AddAsync(entity);

            await _context.SaveChangesAsync();

            var contractDto = ContractDto.FromEntity(entity);

            return(CreatedAtAction("Get", new { }, contractDto));
        }