// BackgroundBuilder\Services\ContactService.cs using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using BackgroundBuilder.Models; using BackgroundBuilder.Repositories; namespace BackgroundBuilder.Services { public class ContactService(IContatoRepository repo) : IContactService { private readonly IContatoRepository _repo = repo; public Task> GetAllAsync() => _repo.GetAllAsync(); public Task InsertUpdateAsync(Contato contato) => _repo.InsertUpdateAsync(contato); public Task AddAsync(Contato contato) => _repo.InsertUpdateAsync(contato); public Task DeleteAsync(string ramal) => _repo.DeleteAsync(ramal); public IEnumerable GetComando(IEnumerable all) => all.Where(c => c.IsComando); public IEnumerable GetSemComando(IEnumerable all) => all.Where(c => !c.IsComando).OrderBy(x => x.Nome); public IEnumerable GetAniversarios(IEnumerable all) => all.Where(c => c.Aniversario.HasValue).OrderBy(x => (x.Aniversario ?? DateTime.MinValue).Day).OrderBy(x => (x.Aniversario ?? DateTime.MinValue).Month); } }