Esempio n. 1
0
        public async Task <ActionResult <string> > Post([FromBody] PauseCameraModel value)
        {
            if (!_apiKeyAuthorization.IsValid(value.ApiKey))
            {
                return(BadRequest());
            }

            await _blueIrisService.PauseAsync(value);

            return(Ok());
        }
Esempio n. 2
0
        public async Task PauseAsync(PauseCameraModel pauseCameraModel)
        {
            await LoginAsync();

            pauseCameraModel.session = session;

            string camera = pauseCameraModel.camera;

            if (pauseCameraModel.camera.StartsWith("the "))
            {
                camera = pauseCameraModel.camera.Substring(4);
            }

            var tasks = GetPauseAmountsForHours(pauseCameraModel.pause)
                        .Select(val => new PauseCameraModel()
            {
                ApiKey = pauseCameraModel.ApiKey, pause = val, session = session, camera = camera
            })
                        .Select(model => _url.PostJsonAsync(model)).ToArray();

            Task.WaitAll(tasks);
        }