Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model List<SuperCharactersApp.ViewModels.DTO.CharacterViewModels.CharacterViewModel>
- @{
- ViewData["Title"] = "ListCharacters";
- var cnt = 0;
- string noSecretIdentity = "Too secret to be known.";
- }
- <table class="table table-striped">
- <thead>
- <tr>
- <td align="center"></td>
- <th scope="col">Operations</th>
- <th scope="col">#</th>
- <th scope="col">Name</th>
- <th scope="col">Character type</th>
- <th scope="col">Armour</th>
- <th scope="col">Damage</th>
- <th scope="col">HitPoints</th>
- <th scope="col">Secret identity</th>
- <th scope="col">SuperPowers</th>
- <th scope="col">Team</th>
- </tr>
- </thead>
- <tbody>
- @foreach (var character in Model)
- {
- cnt++;
- <tr>
- <td align="center"></td>
- <th scope="row">
- <div class="btn-group" role="group">
- <a href="#" class="btn btn-light btn-sm">
- <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
- <span>Edit</span>
- </a>
- <a href="#" class="btn btn-info btn-sm">
- <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
- <span>View</span>
- </a>
- <button type="button" class="btn btn-danger btn-sm"
- data-toggle="modal" data-target="#modalDelete">
- <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
- <span>Delete</span>
- </button>
- <partial name="_ReusableModal"
- model='character.Id' />
- </div>
- </th>
- <th scope="row">@cnt</th>
- <td>@character.Name</td>
- <td>@character.CharacterType</td>
- <td>@character.Armour</td>
- <td>@character.Damage</td>
- <td>@character.HitPoints</td>
- <td>
- @(String.IsNullOrEmpty(Model.Where(a => a.SecretIdentity.FirstName == character.SecretIdentity.FirstName)
- .Select(a => a.SecretIdentity.FirstName).FirstOrDefault()) ?
- noSecretIdentity :
- String.Concat(Model.Where(a => a.SecretIdentity.LastName == character.SecretIdentity.LastName)
- .Select(x => x.SecretIdentity.FirstName).FirstOrDefault(),
- " ",
- Model.Select(x => x.SecretIdentity.LastName).FirstOrDefault()))
- </td>
- <td>@character.SuperPowers.Count()</td>
- <td>@character.Team.Name</td>
- </tr>
- }
- </tbody>
- </table>
Add Comment
Please, Sign In to add comment