Reputation: 113
How can I decrypt a field before it is shown in the view? Right now I'm calling the method to encrypt that field, then save that encryption inside the database, then after I want to decrypt that value so it is shown properly inside the view. Both encrypt and decrypt method work, the problem as stated is that I don't know where to call the decrypt function before the view loads.
I want that the decryption is done as this view is being shown
public ActionResult Item()
{
Repository rep = new Repository();
var getItems = rep.GetItems();
return View(getItems);
}
Upvotes: 0
Views: 264
Reputation: 5442
When you have service layer, should decrypt in service layer in other way to decrypt in Item action or in Item.cshtml (View file)
Upvotes: 1