<

Question 29


70-486 Skills Measured >> 2.3 Design User Experience >>

Question

Drag and Drop
You are developing an ASP.NET MVC application in Visual Studio 2012. The application contains sensitive bank account data. The application contains a helper class named SensitiveData.Helpers.CustomEncryptor.
public class CustomEncryptor
{
public string Encrypt(string plaintext)
{
...
}
}
The application contains a controller named BankAccountController with two actions
public class BankAccountController: Controller
{
public ActionResult GetAcounts()
{
...
}

public ActionResult EditAccount (string maskedAccountNum)
{
...
}
}
The application contains a model named BankAccount which is defined in the following code segment.

public class BankAccount
{
public string AccountNumber {get;set;}
public string AccountName {get;set;}
public double Balance {get;set;}
}
The application must not display AccountNumber in clear text in any URL. You need to build the view for the GetAccounts action.

How should you build the view? (To answer, drag the appropriate code segment to the correct location or locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

  • custEncrypt
  • maskedAccountNum
  • Html
  • Encrypt(item.AccountNumber)
  • Encode(item.AccountNumber)
@model IEnumberable<SensitiveData.Models.GamerAccount>
<table>
<tr>
<th>Account Name</th>
<th>Balance</th>
</tr>
@foreach (var item in Model)
{
&tr>
<td>@Html.DisplayFor(modelItem => item.AccountName)</td>
<td>@Html.DisplayFor(modelItem => item.Highscore)</td>
<td>@Html.ActionLink("Edit","EditAccount", new {
    =
      .
        })</td>
        </tr>
        }
        </table>

        Answer:

        • Html
        • Encode(item.AccountNumber)
        @model IEnumberable<SensitiveData.Models.GamerAccount>
        <table>
        <tr>
        <th>Account Name</th>
        <th>Balance</th>
        </tr>
        @foreach (var item in Model)
        {
        <tr>
        <td>@Html.DisplayFor(modelItem => item.AccountName)</td>
        <td>@Html.DisplayFor(modelItem => item.Highscore)</td>
        <td>@Html.ActionLink("Edit","EditAccount", new {
        • maskedAccountNum
        =
        • custEncrypt
        .
        • Encrypt(item.AccountNumber)
        })</td>
        </tr>
        }
        </table>