User89
User89

Reputation: 113

How to decrypt data before the view?

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

Answers (1)

Ramil Aliyev 007
Ramil Aliyev 007

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

Related Questions