Ejemplo n.º 1
0
        public IActionResult PutJob(
            [FromRoute][Required] string device,
            [FromBody][Required] Job job)
        {
            try
            {
                if (job == null)
                {
                    return(BadRequest("Body empty"));
                }

                var deviceId = new DeviceId(device);
                Logger.DebugLogMessage($"Received job from \"{deviceId}\":", job);
                _actionModel.PutJob(deviceId, job);

                return(FormattedOk());
            }
            catch (FormatException e)
            {
                Logger.Error(e);
                return(BadRequest("DeviceId fehlerhaft."));
            }
            catch (Exception e)
            {
                Logger.Error(e);
                return(FormattedInternalServerError());
            }
        }