public async Task <Unit> Handle(AddWorkHoursCommand request, CancellationToken cancellationToken) { var workOrderWorker = _mapper.Map <WorkOrderWorker.Models.WorkOrderWorker>(request); _db.Set <WorkOrderWorker.Models.WorkOrderWorker>().Add(workOrderWorker); await _db.SaveChangesAsync(cancellationToken); return(await Unit.Task); }
public async Task <ApiResponse <WorkerResponse> > Handle(CreateWorkerCommand request, CancellationToken cancellationToken) { var worker = _mapper.Map <Models.Worker>(request); _db.Set <Models.Worker>().Add(worker); await _db.SaveChangesAsync(cancellationToken); var response = _mapper.Map <WorkerResponse>(worker); return(new ApiResponse <WorkerResponse>(response)); }