public async Task <IActionResult> InsertTechnician([FromBody] TechnicianDTO technician)
        {
            try
            {
                Technician objTechnician = new Technician(technician.Name, technician.Lastname, technician.CI, technician.Phone,
                                                          technician.Email);
                await _technicianRepository.Insert(objTechnician);

                await _unitOfWork.Commit();

                return(Ok(new
                {
                    Ok = true,
                    Message = "Registro insertado exitosamente"
                }));
            }
            catch (Exception e)
            {
                return(BadRequest(new
                {
                    Ok = false,
                    Error = e
                }));
            }
        }
Beispiel #2
0
        public async Task <VoidResult> Handle(InsertTechnicianCommand request, CancellationToken cancellationToken)
        {
            Domain.Model.Soporte.Technician technician = new Domain.Model.Soporte.Technician(
                request.technicianDTO.Name, request.technicianDTO.Lastname,
                request.technicianDTO.CI, request.technicianDTO.Phone,
                request.technicianDTO.Email
                );

            await _technicianRepository.Insert(technician);

            await _unitOfWork.Commit();

            return(new VoidResult());
        }