public async Task <VoidResult> Handle(InsertJobFormCommand request, CancellationToken cancellationToken) { Domain.Model.Soporte.JobForm jobForm = new Domain.Model.Soporte.JobForm( request.jobFormDTO.Detail, request.jobFormDTO.Date, new Domain.Model.Soporte.Appointment(request.jobFormDTO.Appointment.AppointmentId) ); await _jobFormRepository.Insert(jobForm); await _unitOfWork.Commit(); return(new VoidResult()); }
public async Task <IActionResult> InsertAppointment([FromBody] JobFormDTO jobForm) { try { JobForm objJobForm = new JobForm(jobForm.Detail, jobForm.Date, new Appointment(jobForm.Appointment.AppointmentId)); await _jobFormRepository.Insert(objJobForm); await _unitOfWork.Commit(); return(Ok(new { Ok = true, Message = "Registro insertado exitosamente" })); } catch (Exception e) { return(BadRequest(new { Ok = false, Error = e })); } }