Skip to content

Commit 1d3d9c2

Browse files
committed
Remove duplicate check for ModelState validity
Two other minor questions: - Why not move the check for whether the product exists to before attaching and saving? Would also remove the need for the try/catch around SaveChanges(). - Use Any() instead of Count() in the ProductExists method.
1 parent f8f6042 commit 1d3d9c2

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

grid/odata-v4-web-api-binding-wrappers/KendoUIMVC5/Controllers/ProductsController.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ public IHttpActionResult Put([FromODataUri] int key, Product product)
4343
return BadRequest(ModelState);
4444
}
4545

46-
if (!ModelState.IsValid)
47-
{
48-
return BadRequest(ModelState);
49-
}
50-
5146
if (key != product.ProductID)
5247
{
5348
return BadRequest();

0 commit comments

Comments
 (0)