示例#1
0
        public async Task <IActionResult> PutCategory([FromRoute] int id, [FromBody] Category category)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != category.Id)
            {
                return(BadRequest());
            }

            if (!await categoryDAO.UpdateAsync(category))
            {
                return(StatusCode(categoryDAO.GetCustomError().StatusCode, categoryDAO.GetCustomError()));
            }

            return(NoContent());
        }