コード例 #1
0
        public async Task <IActionResult> GetAllTechnicians()
        {
            try
            {
                List <Technician> technicianList = await _technicianRepository.GetTechnicians();

                return(Ok(new
                {
                    technicians = technicianList
                }));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public IActionResult GetTechnicians()
 {
     return(Ok(repository.GetTechnicians()));
 }