Exemple #1
0
        public IActionResult Update(InputChannelEvent model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Model is incomplete"));
            }

            var bearerValid = IsBearerValid(Request, model.Name);

            if (!bearerValid)
            {
                return(BadRequest("Authorisation Error"));
            }

            try
            {
                var newStatusContent = _updateStatusContent.AddOrUpdate(model);

                UpdateIsFreeSocket(newStatusContent);

                return(Ok(newStatusContent.Weight));
            }
            catch (ApplicationException)
            {
                return(new StatusCodeResult(500));
            }
            catch (NotImplementedException)
            {
                return(BadRequest("Name does not exist"));
            }
        }