Adding a Summary Message
.NET MVC has another method to store temporary messages.
The syntax is TempData["Message"] = "Your entry was succesfully added!";
Try to add it if the ModelState is valid for three actions, Add, Edit, and Delete.
Designer team has provided us with HTML markup to display the summary message.
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span></button>
Your entry was successfully added!
</div>
In order to display the message, the proper place to show it is in Index cshtml page.
@if (TempData["Message"] != null)
{
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
TempData["Message"]
</div>
}