public async Task <IActionResult> Create([FromBody] Autor obj) { try { if (!ModelState.IsValid || obj == null) { return(BadRequest(ModelState)); } var newautor = await _autorbusiness.Create(obj); return(CreatedAtRoute("GetByIdAutor", new { id = newautor.Id }, newautor)); } catch (Exception e) { return(BadRequest($"{e.Message} - {e.InnerException}")); } }
public async Task <ActionResult> Post([FromBody] AutoreDTO data) { var result = await business.Create(data); return(StatusCode(result.Code, result)); }