Highlight modified code (#4185)

* Highlight modified code

* Highlight code based on livefyre comment
pull/4209/head
Bader Nasser Al-Hashmi 2017-09-05 19:00:50 +04:00 committed by Scott Addie
parent 6a7cb40282
commit a98cef6abd
1 changed files with 3 additions and 3 deletions

View File

@ -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: