Add CRUD admin pages for screens.

This commit is contained in:
2019-06-01 22:59:18 +01:00
parent 63c2f4c7a8
commit 2022dc0080
20 changed files with 1200 additions and 1 deletions

View File

@@ -0,0 +1,150 @@
using System.Linq;
using System.Threading.Tasks;
using Cicm.Database.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query;
namespace cicm_web.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class ResolutionsByScreenController : Controller
{
readonly cicmContext _context;
public ResolutionsByScreenController(cicmContext context)
{
_context = context;
}
// GET: ResolutionsByScreen
public async Task<IActionResult> Index()
{
IIncludableQueryable<ResolutionsByScreen, Screen> cicmContext =
_context.ResolutionsByScreen.Include(r => r.Resolution).Include(r => r.Screen);
return View(await cicmContext.ToListAsync());
}
// GET: ResolutionsByScreen/Details/5
public async Task<IActionResult> Details(long? id)
{
if(id == null) return NotFound();
ResolutionsByScreen resolutionsByScreen = await _context.ResolutionsByScreen
.Include(r => r.Resolution).Include(r => r.Screen)
.FirstOrDefaultAsync(m => m.Id == id);
if(resolutionsByScreen == null) return NotFound();
return View(resolutionsByScreen);
}
// GET: ResolutionsByScreen/Create
public IActionResult Create()
{
ViewData["ResolutionId"] = new SelectList(_context.Resolutions, "Id", "Id");
ViewData["ScreenId"] = new SelectList(_context.Screens, "Id", "Type");
return View();
}
// POST: ResolutionsByScreen/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(
[Bind("ScreenId,ResolutionId,Id")] ResolutionsByScreen resolutionsByScreen)
{
if(ModelState.IsValid)
{
_context.Add(resolutionsByScreen);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
ViewData["ResolutionId"] =
new SelectList(_context.Resolutions, "Id", "Id", resolutionsByScreen.ResolutionId);
ViewData["ScreenId"] = new SelectList(_context.Screens, "Id", "Type", resolutionsByScreen.ScreenId);
return View(resolutionsByScreen);
}
// GET: ResolutionsByScreen/Edit/5
public async Task<IActionResult> Edit(long? id)
{
if(id == null) return NotFound();
ResolutionsByScreen resolutionsByScreen = await _context.ResolutionsByScreen.FindAsync(id);
if(resolutionsByScreen == null) return NotFound();
ViewData["ResolutionId"] =
new SelectList(_context.Resolutions, "Id", "Id", resolutionsByScreen.ResolutionId);
ViewData["ScreenId"] = new SelectList(_context.Screens, "Id", "Type", resolutionsByScreen.ScreenId);
return View(resolutionsByScreen);
}
// POST: ResolutionsByScreen/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(
long id, [Bind("ScreenId,ResolutionId,Id")] ResolutionsByScreen resolutionsByScreen)
{
if(id != resolutionsByScreen.Id) return NotFound();
if(ModelState.IsValid)
{
try
{
_context.Update(resolutionsByScreen);
await _context.SaveChangesAsync();
}
catch(DbUpdateConcurrencyException)
{
if(!ResolutionsByScreenExists(resolutionsByScreen.Id)) return NotFound();
throw;
}
return RedirectToAction(nameof(Index));
}
ViewData["ResolutionId"] =
new SelectList(_context.Resolutions, "Id", "Id", resolutionsByScreen.ResolutionId);
ViewData["ScreenId"] = new SelectList(_context.Screens, "Id", "Type", resolutionsByScreen.ScreenId);
return View(resolutionsByScreen);
}
// GET: ResolutionsByScreen/Delete/5
public async Task<IActionResult> Delete(long? id)
{
if(id == null) return NotFound();
ResolutionsByScreen resolutionsByScreen = await _context.ResolutionsByScreen
.Include(r => r.Resolution).Include(r => r.Screen)
.FirstOrDefaultAsync(m => m.Id == id);
if(resolutionsByScreen == null) return NotFound();
return View(resolutionsByScreen);
}
// POST: ResolutionsByScreen/Delete/5
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(long id)
{
ResolutionsByScreen resolutionsByScreen = await _context.ResolutionsByScreen.FindAsync(id);
_context.ResolutionsByScreen.Remove(resolutionsByScreen);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
bool ResolutionsByScreenExists(long id)
{
return _context.ResolutionsByScreen.Any(e => e.Id == id);
}
}
}

View File

@@ -0,0 +1,146 @@
using System.Linq;
using System.Threading.Tasks;
using Cicm.Database.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query;
namespace cicm_web.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class ScreensByMachineController : Controller
{
readonly cicmContext _context;
public ScreensByMachineController(cicmContext context)
{
_context = context;
}
// GET: ScreensByMachine
public async Task<IActionResult> Index()
{
IIncludableQueryable<ScreensByMachine, Screen> cicmContext =
_context.ScreensByMachine.Include(s => s.Machine).Include(s => s.Screen);
return View(await cicmContext.ToListAsync());
}
// GET: ScreensByMachine/Details/5
public async Task<IActionResult> Details(long? id)
{
if(id == null) return NotFound();
ScreensByMachine screensByMachine = await _context.ScreensByMachine
.Include(s => s.Machine).Include(s => s.Screen)
.FirstOrDefaultAsync(m => m.Id == id);
if(screensByMachine == null) return NotFound();
return View(screensByMachine);
}
// GET: ScreensByMachine/Create
public IActionResult Create()
{
ViewData["MachineId"] = new SelectList(_context.Machines, "Id", "Name");
ViewData["ScreenId"] = new SelectList(_context.Screens, "Id", "Type");
return View();
}
// POST: ScreensByMachine/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("ScreenId,MachineId,Id")] ScreensByMachine screensByMachine)
{
if(ModelState.IsValid)
{
_context.Add(screensByMachine);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
ViewData["MachineId"] = new SelectList(_context.Machines, "Id", "Name", screensByMachine.MachineId);
ViewData["ScreenId"] = new SelectList(_context.Screens, "Id", "Type", screensByMachine.ScreenId);
return View(screensByMachine);
}
// GET: ScreensByMachine/Edit/5
public async Task<IActionResult> Edit(long? id)
{
if(id == null) return NotFound();
ScreensByMachine screensByMachine = await _context.ScreensByMachine.FindAsync(id);
if(screensByMachine == null) return NotFound();
ViewData["MachineId"] = new SelectList(_context.Machines, "Id", "Name", screensByMachine.MachineId);
ViewData["ScreenId"] = new SelectList(_context.Screens, "Id", "Type", screensByMachine.ScreenId);
return View(screensByMachine);
}
// POST: ScreensByMachine/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(
long id, [Bind("ScreenId,MachineId,Id")] ScreensByMachine screensByMachine)
{
if(id != screensByMachine.Id) return NotFound();
if(ModelState.IsValid)
{
try
{
_context.Update(screensByMachine);
await _context.SaveChangesAsync();
}
catch(DbUpdateConcurrencyException)
{
if(!ScreensByMachineExists(screensByMachine.Id)) return NotFound();
throw;
}
return RedirectToAction(nameof(Index));
}
ViewData["MachineId"] = new SelectList(_context.Machines, "Id", "Name", screensByMachine.MachineId);
ViewData["ScreenId"] = new SelectList(_context.Screens, "Id", "Type", screensByMachine.ScreenId);
return View(screensByMachine);
}
// GET: ScreensByMachine/Delete/5
public async Task<IActionResult> Delete(long? id)
{
if(id == null) return NotFound();
ScreensByMachine screensByMachine = await _context.ScreensByMachine
.Include(s => s.Machine).Include(s => s.Screen)
.FirstOrDefaultAsync(m => m.Id == id);
if(screensByMachine == null) return NotFound();
return View(screensByMachine);
}
// POST: ScreensByMachine/Delete/5
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(long id)
{
ScreensByMachine screensByMachine = await _context.ScreensByMachine.FindAsync(id);
_context.ScreensByMachine.Remove(screensByMachine);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
bool ScreensByMachineExists(long id)
{
return _context.ScreensByMachine.Any(e => e.Id == id);
}
}
}

View File

@@ -0,0 +1,125 @@
using System.Linq;
using System.Threading.Tasks;
using Cicm.Database.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace cicm_web.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class ScreensController : Controller
{
readonly cicmContext _context;
public ScreensController(cicmContext context)
{
_context = context;
}
// GET: Screens
public async Task<IActionResult> Index() => View(await _context.Screens.ToListAsync());
// GET: Screens/Details/5
public async Task<IActionResult> Details(int? id)
{
if(id == null) return NotFound();
Screen screen = await _context.Screens.FirstOrDefaultAsync(m => m.Id == id);
if(screen == null) return NotFound();
return View(screen);
}
// GET: Screens/Create
public IActionResult Create() => View();
// POST: Screens/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Width,Height,Diagonal,EffectiveColors,Type,Id")]
Screen screen)
{
if(ModelState.IsValid)
{
_context.Add(screen);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(screen);
}
// GET: Screens/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if(id == null) return NotFound();
Screen screen = await _context.Screens.FindAsync(id);
if(screen == null) return NotFound();
return View(screen);
}
// POST: Screens/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Width,Height,Diagonal,EffectiveColors,Type,Id")]
Screen screen)
{
if(id != screen.Id) return NotFound();
if(ModelState.IsValid)
{
try
{
_context.Update(screen);
await _context.SaveChangesAsync();
}
catch(DbUpdateConcurrencyException)
{
if(!ScreenExists(screen.Id)) return NotFound();
throw;
}
return RedirectToAction(nameof(Index));
}
return View(screen);
}
// GET: Screens/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if(id == null) return NotFound();
Screen screen = await _context.Screens.FirstOrDefaultAsync(m => m.Id == id);
if(screen == null) return NotFound();
return View(screen);
}
// POST: Screens/Delete/5
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Screen screen = await _context.Screens.FindAsync(id);
_context.Screens.Remove(screen);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
bool ScreenExists(int id)
{
return _context.Screens.Any(e => e.Id == id);
}
}
}

View File

@@ -0,0 +1,46 @@
@model Cicm.Database.Models.ResolutionsByScreen
@{
ViewData["Title"] = "Create";
}
<h1>Create</h1>
<h4>ResolutionsByScreen</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly"
class="text-danger">
</div>
<div class="form-group">
<label asp-for="ScreenId"
class="control-label">
</label>
<select asp-for="ScreenId"
class="form-control"
asp-items="ViewBag.ScreenId">
</select>
</div>
<div class="form-group">
<label asp-for="ResolutionId"
class="control-label">
</label>
<select asp-for="ResolutionId"
class="form-control"
asp-items="ViewBag.ResolutionId">
</select>
</div>
<div class="form-group">
<input class="btn btn-primary"
type="submit"
value="Create" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,36 @@
@model Cicm.Database.Models.ResolutionsByScreen
@{
ViewData["Title"] = "Delete";
}
<h1>Delete</h1>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>ResolutionsByScreen</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Screen)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Screen.Type)
</dd class>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Resolution)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Resolution.Id)
</dd class>
</dl>
<form asp-action="Delete">
<input type="hidden"
asp-for="Id" />
<input class="btn btn-danger"
type="submit"
value="Delete" /> |
<a asp-action="Index">Back to List</a>
</form>
</div>

View File

@@ -0,0 +1,33 @@
@model Cicm.Database.Models.ResolutionsByScreen
@{
ViewData["Title"] = "Details";
}
<h1>Details</h1>
<div>
<h4>ResolutionsByScreen</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Screen)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Screen.Type)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Resolution)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Resolution.Id)
</dd>
</dl>
</div>
<div>
<a asp-action="Edit"
asp-route-id="@Model.Id">
Edit
</a> |
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,54 @@
@model Cicm.Database.Models.ResolutionsByScreen
@{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>ResolutionsByScreen</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly"
class="text-danger">
</div>
<div class="form-group">
<label asp-for="ScreenId"
class="control-label">
</label>
<select asp-for="ScreenId"
class="form-control"
asp-items="ViewBag.ScreenId">
</select>
<span asp-validation-for="ScreenId"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="ResolutionId"
class="control-label">
</label>
<select asp-for="ResolutionId"
class="form-control"
asp-items="ViewBag.ResolutionId">
</select>
<span asp-validation-for="ResolutionId"
class="text-danger">
</span>
</div>
<input type="hidden"
asp-for="Id" />
<div class="form-group">
<input class="btn btn-primary"
type="submit"
value="Save" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,52 @@
@using Cicm.Database.Models
@model IEnumerable<Cicm.Database.Models.ResolutionsByScreen>
@{
ViewData["Title"] = "Index";
}
<h1>Index</h1>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Screen)
</th>
<th>
@Html.DisplayNameFor(model => model.Resolution)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach(ResolutionsByScreen item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Screen.Type)
</td>
<td>
@Html.DisplayFor(modelItem => item.Resolution.Id)
</td>
<td>
<a asp-action="Edit"
asp-route-id="@item.Id">
Edit
</a> |
<a asp-action="Details"
asp-route-id="@item.Id">
Details
</a> |
<a asp-action="Delete"
asp-route-id="@item.Id">
Delete
</a>
</td>
</tr>
}
</tbody>
</table>

View File

@@ -0,0 +1,78 @@
@model Cicm.Database.Models.Screen
@{
ViewData["Title"] = "Create";
}
<h1>Create</h1>
<h4>Screen</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly"
class="text-danger">
</div>
<div class="form-group">
<label asp-for="Width"
class="control-label">
</label>
<input asp-for="Width"
class="form-control" />
<span asp-validation-for="Width"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Height"
class="control-label">
</label>
<input asp-for="Height"
class="form-control" />
<span asp-validation-for="Height"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Diagonal"
class="control-label">
</label>
<input asp-for="Diagonal"
class="form-control" />
<span asp-validation-for="Diagonal"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="EffectiveColors"
class="control-label">
</label>
<input asp-for="EffectiveColors"
class="form-control" />
<span asp-validation-for="EffectiveColors"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Type"
class="control-label">
</label>
<input asp-for="Type"
class="form-control" />
<span asp-validation-for="Type"
class="text-danger">
</span>
</div>
<div class="form-group">
<input class="btn btn-primary"
type="submit"
value="Create" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,54 @@
@model Cicm.Database.Models.Screen
@{
ViewData["Title"] = "Delete";
}
<h1>Delete</h1>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Screen</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Width)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Width)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Height)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Height)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Diagonal)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Diagonal)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.EffectiveColors)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.EffectiveColors)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Type)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Type)
</dd>
</dl>
<form asp-action="Delete">
<input type="hidden"
asp-for="Id" />
<input class="btn btn-danger"
type="submit"
value="Delete" /> |
<a asp-action="Index">Back to List</a>
</form>
</div>

View File

@@ -0,0 +1,51 @@
@model Cicm.Database.Models.Screen
@{
ViewData["Title"] = "Details";
}
<h1>Details</h1>
<div>
<h4>Screen</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Width)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Width)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Height)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Height)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Diagonal)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Diagonal)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.EffectiveColors)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.EffectiveColors)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Type)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Type)
</dd>
</dl>
</div>
<div>
<a asp-action="Edit"
asp-route-id="@Model.Id">
Edit
</a> |
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,80 @@
@model Cicm.Database.Models.Screen
@{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>Screen</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly"
class="text-danger">
</div>
<div class="form-group">
<label asp-for="Width"
class="control-label">
</label>
<input asp-for="Width"
class="form-control" />
<span asp-validation-for="Width"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Height"
class="control-label">
</label>
<input asp-for="Height"
class="form-control" />
<span asp-validation-for="Height"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Diagonal"
class="control-label">
</label>
<input asp-for="Diagonal"
class="form-control" />
<span asp-validation-for="Diagonal"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="EffectiveColors"
class="control-label">
</label>
<input asp-for="EffectiveColors"
class="form-control" />
<span asp-validation-for="EffectiveColors"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Type"
class="control-label">
</label>
<input asp-for="Type"
class="form-control" />
<span asp-validation-for="Type"
class="text-danger">
</span>
</div>
<input type="hidden"
asp-for="Id" />
<div class="form-group">
<input class="btn btn-primary"
type="submit"
value="Save" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,70 @@
@using Cicm.Database.Models
@model IEnumerable<Cicm.Database.Models.Screen>
@{
ViewData["Title"] = "Index";
}
<h1>Index</h1>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Width)
</th>
<th>
@Html.DisplayNameFor(model => model.Height)
</th>
<th>
@Html.DisplayNameFor(model => model.Diagonal)
</th>
<th>
@Html.DisplayNameFor(model => model.EffectiveColors)
</th>
<th>
@Html.DisplayNameFor(model => model.Type)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach(Screen item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Width)
</td>
<td>
@Html.DisplayFor(modelItem => item.Height)
</td>
<td>
@Html.DisplayFor(modelItem => item.Diagonal)
</td>
<td>
@Html.DisplayFor(modelItem => item.EffectiveColors)
</td>
<td>
@Html.DisplayFor(modelItem => item.Type)
</td>
<td>
<a asp-action="Edit"
asp-route-id="@item.Id">
Edit
</a> |
<a asp-action="Details"
asp-route-id="@item.Id">
Details
</a> |
<a asp-action="Delete"
asp-route-id="@item.Id">
Delete
</a>
</td>
</tr>
}
</tbody>
</table>

View File

@@ -0,0 +1,46 @@
@model Cicm.Database.Models.ScreensByMachine
@{
ViewData["Title"] = "Create";
}
<h1>Create</h1>
<h4>ScreensByMachine</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly"
class="text-danger">
</div>
<div class="form-group">
<label asp-for="ScreenId"
class="control-label">
</label>
<select asp-for="ScreenId"
class="form-control"
asp-items="ViewBag.ScreenId">
</select>
</div>
<div class="form-group">
<label asp-for="MachineId"
class="control-label">
</label>
<select asp-for="MachineId"
class="form-control"
asp-items="ViewBag.MachineId">
</select>
</div>
<div class="form-group">
<input class="btn btn-primary"
type="submit"
value="Create" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,36 @@
@model Cicm.Database.Models.ScreensByMachine
@{
ViewData["Title"] = "Delete";
}
<h1>Delete</h1>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>ScreensByMachine</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Screen)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Screen.Type)
</dd class>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Machine)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Machine.Name)
</dd class>
</dl>
<form asp-action="Delete">
<input type="hidden"
asp-for="Id" />
<input class="btn btn-danger"
type="submit"
value="Delete" /> |
<a asp-action="Index">Back to List</a>
</form>
</div>

View File

@@ -0,0 +1,33 @@
@model Cicm.Database.Models.ScreensByMachine
@{
ViewData["Title"] = "Details";
}
<h1>Details</h1>
<div>
<h4>ScreensByMachine</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Screen)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Screen.Type)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Machine)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Machine.Name)
</dd>
</dl>
</div>
<div>
<a asp-action="Edit"
asp-route-id="@Model.Id">
Edit
</a> |
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,54 @@
@model Cicm.Database.Models.ScreensByMachine
@{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>ScreensByMachine</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly"
class="text-danger">
</div>
<div class="form-group">
<label asp-for="ScreenId"
class="control-label">
</label>
<select asp-for="ScreenId"
class="form-control"
asp-items="ViewBag.ScreenId">
</select>
<span asp-validation-for="ScreenId"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="MachineId"
class="control-label">
</label>
<select asp-for="MachineId"
class="form-control"
asp-items="ViewBag.MachineId">
</select>
<span asp-validation-for="MachineId"
class="text-danger">
</span>
</div>
<input type="hidden"
asp-for="Id" />
<div class="form-group">
<input class="btn btn-primary"
type="submit"
value="Save" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>

View File

@@ -0,0 +1,52 @@
@using Cicm.Database.Models
@model IEnumerable<Cicm.Database.Models.ScreensByMachine>
@{
ViewData["Title"] = "Index";
}
<h1>Index</h1>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Screen)
</th>
<th>
@Html.DisplayNameFor(model => model.Machine)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach(ScreensByMachine item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Screen.Type)
</td>
<td>
@Html.DisplayFor(modelItem => item.Machine.Name)
</td>
<td>
<a asp-action="Edit"
asp-route-id="@item.Id">
Edit
</a> |
<a asp-action="Details"
asp-route-id="@item.Id">
Details
</a> |
<a asp-action="Delete"
asp-route-id="@item.Id">
Delete
</a>
</td>
</tr>
}
</tbody>
</table>

View File

@@ -4,5 +4,8 @@
"LogLevel": {
"Default": "Warning"
}
},
"ConnectionStrings": {
"cicmContext": "Server=(localdb)\\mssqllocaldb;Database=cicmContext-3ead5ce4-a116-44e6-a347-9791facb4ffc;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Version>3.0.99.712</Version>
<Version>3.0.99.715</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>