public IActionResult Connect(Guid id) { var watcher = _watchersRepository.GetSingle(id); _watcherService.StartNewWatcher(watcher); return(Accepted()); }
public async Task <IActionResult> Create([FromBody] CreateWatcherDto watcherData) { if (watcherData == null) { return(BadRequest()); } var data = new WatcherData { IpAddress = watcherData.IpAddress, Mib = watcherData.Mib, Method = watcherData.Method, UpdatesEvery = watcherData.UpdatesEvery }; _watchersRepository.Create(data); _watcherService.StartNewWatcher(data); await _watchersRepository.SaveChangesAsync(); return(CreatedAtRoute("GetSingleWatcher", new { Controller = "Watchers", id = data.Id.ToString() }, data)); }