diff --git a/aspnetcore/data/ef-mvc/concurrency.md b/aspnetcore/data/ef-mvc/concurrency.md index 4dd4887c17..ef605d3e87 100644 --- a/aspnetcore/data/ef-mvc/concurrency.md +++ b/aspnetcore/data/ef-mvc/concurrency.md @@ -210,13 +210,13 @@ For the Delete page, the Entity Framework detects concurrency conflicts caused b In *DepartmentsController.cs*, replace the HttpGet `Delete` method with the following code: -[!code-csharp[Main](intro/samples/cu/Controllers/DepartmentsController.cs?name=snippet_DeleteGet&highlight=1,14-17,21-29)] +[!code-csharp[Main](intro/samples/cu/Controllers/DepartmentsController.cs?name=snippet_DeleteGet&highlight=1,10,14-17,21-29)] The method accepts an optional parameter that indicates whether the page is being redisplayed after a concurrency error. If this flag is true and the department specified no longer exists, it was deleted by another user. In that case, the code redirects to the Index page. If this flag is true and the Department does exist, it was changed by another user. In that case, the code sends an error message to the view using `ViewData`. Replace the code in the HttpPost `Delete` method (named `DeleteConfirmed`) with the following code: -[!code-csharp[Main](intro/samples/cu/Controllers/DepartmentsController.cs?name=snippet_DeletePost&highlight=3,7,14,15,16,17,18)] +[!code-csharp[Main](intro/samples/cu/Controllers/DepartmentsController.cs?name=snippet_DeletePost&highlight=1,3,5-8,11-18)] In the scaffolded code that you just replaced, this method accepted only a record ID: @@ -241,7 +241,7 @@ If a concurrency error is caught, the code redisplays the Delete confirmation pa In *Views/Departments/Delete.cshtml*, replace the scaffolded code with the following code that adds an error message field and hidden fields for the DepartmentID and RowVersion properties. The changes are highlighted. -[!code-html[Main](intro/samples/cu/Views/Departments/Delete.cshtml?highlight=9,38,44)] +[!code-html[Main](intro/samples/cu/Views/Departments/Delete.cshtml?highlight=9,38,44,45,48)] This makes the following changes: