Пример #1
0
        public async Task <ActionResult> Post([FromBody] ParametroDTOCreate parametro)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                var result = await _service.Post(parametro);

                if (result != null)
                {
                    return(Ok(result));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message + " - " + ex.InnerException));
            }
        }