Skip to content

Commit

Permalink
Adding a redirect to action to prevent duplicate POST requests (with …
Browse files Browse the repository at this point in the history
…two different kinds of syntax)
  • Loading branch information
gorohoroh committed Jul 5, 2018
1 parent e005da1 commit a2dc138
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public IActionResult Create(RestaurantEditModel model)

newRestaurant = _restaurantData.Add(newRestaurant);

return View("Details", newRestaurant);
return RedirectToAction("Details", new {id = newRestaurant.Id});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public IActionResult Create(RestaurantEditModel model)

newRestaurant = _restaurantData.Add(newRestaurant);

return View("Details", newRestaurant);
return RedirectToAction(nameof(Details), new { id=newRestaurant.Id });

}
}
Expand Down

0 comments on commit a2dc138

Please sign in to comment.