. , - , . , , . , . , . :
,
if, , TempDatap >
@if(TempData["error"])
{
<div class="notification-error">@TempData[error]</div>
}
@if(TempData["success"])
{
<div class="notification-error">@TempData[error]</div>
}
Then in your controller if you have something to say to the user you can
just do what you are doing like:
public ActionResult SomeAction(MyModel model)
{
if(something is not valid)
{
this.TempData["error"] user error
return this.View(model);
}
}
That case was if you need some server validation and proper message to the
user. After that option you have to set a script on your layout that removes
the error and success notifications if they exist on the page loads.
, , js- , viewmodel, , .
: , JS toastr. URL-
, , .