public async Task AddWatchAsync(IUnitOfWork unitOfWork, SyncWatch syncWatch) { var syncWatchRepository = unitOfWork.GetRepository <ISyncWatchRepository>(); await syncWatchRepository.AddAsync(syncWatch); _watchService.StartWatching(syncWatch.SourcePath, syncWatch.TargetPath); }
public override async Task <AddSyncResponse> AddSync(AddSyncRequest request, ServerCallContext context) { using var unitOfWork = _unitOfWorkFactory.Create(); var syncWatch = new SyncWatch { SourcePath = request.SourcePath, TargetPath = request.TargetPath }; await _syncService.AddWatchAsync(unitOfWork, syncWatch); await unitOfWork.CommitAsync(); return(new AddSyncResponse { Result = ErrorCode.Ok, ErrorMessage = string.Empty, Sync = new Sync { SourcePath = syncWatch.SourcePath, TargetPath = syncWatch.TargetPath } }); }
public async Task AddAsync(SyncWatch watch) { await _context.AddAsync(watch); }