Пример #1
0
        public async Task <IActionResult> CreateSystem(string name = null)
        {
            // Check that input is provided
            if (name == null)
            {
                return(BadRequest(new GeneralMessage()
                {
                    Message = "New system name is not specified"
                }));
            }

            // Do the request
            var response = await _dbHandler.AddSystemAsync(name);

            if (response.MessageType == MessageType.NOK)
            {
                return(BadRequest(new GeneralMessage()
                {
                    Message = response.MessageText
                }));
            }

            return(Ok(new GeneralMessage()
            {
                Message = response.MessageText
            }));
        }