Пример #1
0
        public IActionResult Post([FromBody] UsuarioInput input)
        {
            try
            {
                CheckStatus checkStatus = null;
                if (ModelState.IsValid)
                {
                    checkStatus = _manager.Create(input);

                    if (checkStatus.apiEstado.Equals(Status.Error))
                    {
                        return(StatusCode(422, checkStatus));
                    }
                    return(StatusCode(201, checkStatus));
                }
                else
                {
                    checkStatus = new CheckStatus(Status.Error, Mensaje.InputInvalido);
                    return(StatusCode(422, checkStatus));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(LoggingEvents.SERVICE_ERROR, ex, ex.Message);
                return(new EmptyResult());
            }
        }