public async Task <ActionResult <Category> > PostCategory([FromBody] Category category) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!await categoryDAO.AddAsync(category)) { return(StatusCode(categoryDAO.GetCustomError().StatusCode, categoryDAO.GetCustomError())); } return(CreatedAtAction("GetCategory", new { id = category.Id }, category)); }