Implement index admin page for resolutions by screen.

This commit is contained in:
2019-06-02 01:39:51 +01:00
parent fdf1787146
commit e8d8000922
2 changed files with 8 additions and 6 deletions

View File

@@ -50,7 +50,7 @@ namespace cicm_web.Areas.Admin.Controllers
"Id", "Name"); "Id", "Name");
ViewData["ScreenId"] = ViewData["ScreenId"] =
new new
SelectList(_context.Screens.Select(s => new {s.Id, Name = s.NativeResolution != null ? $"{s.Diagonal}\" {s.Type} at {s.NativeResolution}" : $"{s.Diagonal}\" {s.Type}"}).OrderBy(s => s.Name), SelectList(_context.Screens.Select(s => new {s.Id, Name = s.NativeResolution != null ? $"{s.Diagonal}\" {s.Type} with {s.NativeResolution}" : $"{s.Diagonal}\" {s.Type}"}).OrderBy(s => s.Name),
"Id", "Name"); "Id", "Name");
return View(); return View();
} }
@@ -75,7 +75,7 @@ namespace cicm_web.Areas.Admin.Controllers
"Id", "Name", resolutionsByScreen.ResolutionId); "Id", "Name", resolutionsByScreen.ResolutionId);
ViewData["ScreenId"] = ViewData["ScreenId"] =
new new
SelectList(_context.Screens.Select(s => new {s.Id, Name = s.NativeResolution != null ? $"{s.Diagonal}\" {s.Type} at {s.NativeResolution}" : $"{s.Diagonal}\" {s.Type}"}).OrderBy(s => s.Name), SelectList(_context.Screens.Select(s => new {s.Id, Name = s.NativeResolution != null ? $"{s.Diagonal}\" {s.Type} with {s.NativeResolution}" : $"{s.Diagonal}\" {s.Type}"}).OrderBy(s => s.Name),
"Id", "Name", resolutionsByScreen.ScreenId); "Id", "Name", resolutionsByScreen.ScreenId);
return View(resolutionsByScreen); return View(resolutionsByScreen);
} }
@@ -93,7 +93,7 @@ namespace cicm_web.Areas.Admin.Controllers
"Id", "Name", resolutionsByScreen.ResolutionId); "Id", "Name", resolutionsByScreen.ResolutionId);
ViewData["ScreenId"] = ViewData["ScreenId"] =
new new
SelectList(_context.Screens.Select(s => new {s.Id, Name = s.NativeResolution != null ? $"{s.Diagonal}\" {s.Type} at {s.NativeResolution}" : $"{s.Diagonal}\" {s.Type}"}).OrderBy(s => s.Name), SelectList(_context.Screens.Select(s => new {s.Id, Name = s.NativeResolution != null ? $"{s.Diagonal}\" {s.Type} with {s.NativeResolution}" : $"{s.Diagonal}\" {s.Type}"}).OrderBy(s => s.Name),
"Id", "Name", resolutionsByScreen.ScreenId); "Id", "Name", resolutionsByScreen.ScreenId);
return View(resolutionsByScreen); return View(resolutionsByScreen);
} }
@@ -130,7 +130,7 @@ namespace cicm_web.Areas.Admin.Controllers
"Id", "Name", resolutionsByScreen.ResolutionId); "Id", "Name", resolutionsByScreen.ResolutionId);
ViewData["ScreenId"] = ViewData["ScreenId"] =
new new
SelectList(_context.Screens.Select(s => new {s.Id, Name = s.NativeResolution != null ? $"{s.Diagonal}\" {s.Type} at {s.NativeResolution}" : $"{s.Diagonal}\" {s.Type}"}).OrderBy(s => s.Name), SelectList(_context.Screens.Select(s => new {s.Id, Name = s.NativeResolution != null ? $"{s.Diagonal}\" {s.Type} with {s.NativeResolution}" : $"{s.Diagonal}\" {s.Type}"}).OrderBy(s => s.Name),
"Id", "Name", resolutionsByScreen.ScreenId); "Id", "Name", resolutionsByScreen.ScreenId);
return View(resolutionsByScreen); return View(resolutionsByScreen);
} }

View File

@@ -30,10 +30,12 @@
{ {
<tr> <tr>
<td> <td>
@Html.DisplayFor(modelItem => item.Screen.Type) @if(item.Screen.NativeResolution != null) { @($"{item.Screen.Diagonal}\" {item.Screen.Type} with {item.Screen.NativeResolution}") }
else
{ @($"{item.Screen.Diagonal}\" {item.Screen.Type}") }
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Resolution.Id) @item.Resolution.ToString()
</td> </td>
<td> <td>
<a asp-action="Details" <a asp-action="Details"