Ejemplo n.º 1
0
        public async Task <IActionResult> PostAsync([FromBody] CodeInputModel value)
        {
            if (value == null)
            {
                return(BadRequest("Invalid input"));
            }

            var result = await _codesService.AddAsync(value);

            if (result == null)
            {
                return(BadRequest("Code not inserted"));
            }

            return(CreatedAtRoute("CodeGetAsync",
                                  new
            {
                id = result.Id
            },
                                  result));
        }