public async Task <IActionResult> GetAllTechnicians() { try { List <Technician> technicianList = await _technicianRepository.GetTechnicians(); return(Ok(new { technicians = technicianList })); } catch (Exception e) { return(BadRequest(e)); } }
public async Task <List <TechnicianDTO> > Handle(GetAllTechniciansQuery request, CancellationToken cancellationToken) { List <Domain.Model.Soporte.Technician> technicians = await _technicianRepository.GetTechnicians(); List <TechnicianDTO> technicianDTOs = new List <TechnicianDTO>(); foreach (var item in technicians) { technicianDTOs.Add( new TechnicianDTO( item.TechnicianId, item.Name, item.Lastname, item.CI, item.Phone, item.Email ) ); } return(technicianDTOs); }
public IActionResult GetTechnicians() { return(Ok(repository.GetTechnicians())); }