Esempio n. 1
0
        public IActionResult PostDataType(DataTypeModel dataType)
        {
            logger.Info($"POST: {Request.Path} called");
            logger.Info("Storing DataType: Id={0}, Name={1}, Properties={2}",
                        dataType.Id,
                        dataType.Name,
                        dataType.Properties);
            if (!ModelState.IsValid)
            {
                logger.Info("Bad request");
                return(BadRequest(ModelState));
            }

            try
            {
                datatypeRepo.AddDataType(dataType);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
            }

            return(Created(Request.Path, dataType));
        }