I am trying to put some validation logic into my controller but I'm having a little trouble.
Here's the code:
if (holidayRequestForm.Approved == true)
{
TempData["msgAlreadyApproved"] = "This Holiday Has already been approved";
return RedirectToAction("Index", "HolidayRequestFroms");
}
My problem is I want to throw an error message for when a user attempts to approve a holiday request that has already been approved but obviously the code above will throw the message when any holiday get set to approved.
How would I go by checking if a change happens in the model and then throwing the temp message if no change has taking place.
thanks
Aucun commentaire:
Enregistrer un commentaire