mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Implement storage by owned machine admin pages.
This commit is contained in:
@@ -0,0 +1,226 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : StorageByOwnedMachinesController.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Storage by machines admin controller
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Cicm.Database.Models;
|
||||||
|
using cicm_web.Areas.Admin.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 StorageByOwnedMachinesController : Controller
|
||||||
|
{
|
||||||
|
readonly cicmContext _context;
|
||||||
|
|
||||||
|
public StorageByOwnedMachinesController(cicmContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: Admin/StorageByOwnedMachines
|
||||||
|
public async Task<IActionResult> Index()
|
||||||
|
{
|
||||||
|
IIncludableQueryable<StorageByOwnedMachine, OwnedMachine> cicmContext =
|
||||||
|
_context.StorageByOwnedMachine.Include(s => s.OwnedMachine);
|
||||||
|
return View(await cicmContext.OrderBy(s => s.OwnedMachine.Machine.Company.Name)
|
||||||
|
.ThenBy(s => s.OwnedMachine.Machine.Name)
|
||||||
|
.ThenBy(s => s.OwnedMachine.User.UserName)
|
||||||
|
.Select(s => new StorageByMachineViewModel
|
||||||
|
{
|
||||||
|
Id = s.Id,
|
||||||
|
Company = s.OwnedMachine.Machine.Company.Name,
|
||||||
|
Machine =
|
||||||
|
$"{s.OwnedMachine.Machine.Company.Name} {s.OwnedMachine.Machine.Name} <{s.OwnedMachine.User.UserName}>",
|
||||||
|
Type = s.Type,
|
||||||
|
Interface = s.Interface,
|
||||||
|
Capacity = s.Capacity
|
||||||
|
}).ToListAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: Admin/StorageByOwnedMachines/Details/5
|
||||||
|
public async Task<IActionResult> Details(long? id)
|
||||||
|
{
|
||||||
|
if(id == null) return NotFound();
|
||||||
|
|
||||||
|
StorageByMachineViewModel storageByOwnedMachine = await _context
|
||||||
|
.StorageByOwnedMachine
|
||||||
|
.OrderBy(s => s.OwnedMachine.Machine.Company.Name)
|
||||||
|
.ThenBy(s => s.OwnedMachine.Machine.Name)
|
||||||
|
.ThenBy(s => s.OwnedMachine.User.UserName)
|
||||||
|
.Select(s => new StorageByMachineViewModel
|
||||||
|
{
|
||||||
|
Id = s.Id,
|
||||||
|
Company =
|
||||||
|
s.OwnedMachine.Machine.Company
|
||||||
|
.Name,
|
||||||
|
Machine =
|
||||||
|
$"{s.OwnedMachine.Machine.Company.Name} {s.OwnedMachine.Machine.Name} <{s.OwnedMachine.User.UserName}>",
|
||||||
|
Type = s.Type,
|
||||||
|
Interface = s.Interface,
|
||||||
|
Capacity = s.Capacity
|
||||||
|
}).FirstOrDefaultAsync(m => m.Id == id);
|
||||||
|
if(storageByOwnedMachine == null) return NotFound();
|
||||||
|
|
||||||
|
return View(storageByOwnedMachine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: Admin/StorageByOwnedMachines/Create
|
||||||
|
public IActionResult Create()
|
||||||
|
{
|
||||||
|
ViewData["OwnedMachineId"] =
|
||||||
|
new
|
||||||
|
SelectList(_context.OwnedMachines.OrderBy(m => m.Machine.Company.Name).ThenBy(m => m.Machine.Name).ThenBy(m => m.User.UserName).Select(m => new {m.Id, Name = $"{m.Machine.Company.Name} {m.Machine.Name} <{m.User.UserName}>"}),
|
||||||
|
"Id", "Name");
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: Admin/StorageByOwnedMachines/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("OwnedMachineId,Type,Interface,Capacity,Id")]
|
||||||
|
StorageByOwnedMachine storageByOwnedMachine)
|
||||||
|
{
|
||||||
|
if(ModelState.IsValid)
|
||||||
|
{
|
||||||
|
_context.Add(storageByOwnedMachine);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return RedirectToAction(nameof(Index));
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewData["OwnedMachineId"] =
|
||||||
|
new
|
||||||
|
SelectList(_context.OwnedMachines.OrderBy(m => m.Machine.Company.Name).ThenBy(m => m.Machine.Name).ThenBy(m => m.User.UserName).Select(m => new {m.Id, Name = $"{m.Machine.Company.Name} {m.Machine.Name} <{m.User.UserName}>"}),
|
||||||
|
"Id", "Name", storageByOwnedMachine.OwnedMachineId);
|
||||||
|
return View(storageByOwnedMachine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: Admin/StorageByOwnedMachines/Edit/5
|
||||||
|
public async Task<IActionResult> Edit(long? id)
|
||||||
|
{
|
||||||
|
if(id == null) return NotFound();
|
||||||
|
|
||||||
|
StorageByOwnedMachine storageByOwnedMachine = await _context.StorageByOwnedMachine.FindAsync(id);
|
||||||
|
if(storageByOwnedMachine == null) return NotFound();
|
||||||
|
|
||||||
|
ViewData["OwnedMachineId"] =
|
||||||
|
new
|
||||||
|
SelectList(_context.OwnedMachines.OrderBy(m => m.Machine.Company.Name).ThenBy(m => m.Machine.Name).ThenBy(m => m.User.UserName).Select(m => new {m.Id, Name = $"{m.Machine.Company.Name} {m.Machine.Name} <{m.User.UserName}>"}),
|
||||||
|
"Id", "Name", storageByOwnedMachine.OwnedMachineId);
|
||||||
|
return View(storageByOwnedMachine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: Admin/StorageByOwnedMachines/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("OwnedMachineId,Type,Interface,Capacity,Id")]
|
||||||
|
StorageByOwnedMachine storageByOwnedMachine)
|
||||||
|
{
|
||||||
|
if(id != storageByOwnedMachine.Id) return NotFound();
|
||||||
|
|
||||||
|
if(ModelState.IsValid)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_context.Update(storageByOwnedMachine);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch(DbUpdateConcurrencyException)
|
||||||
|
{
|
||||||
|
if(!StorageByOwnedMachineExists(storageByOwnedMachine.Id)) return NotFound();
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RedirectToAction(nameof(Index));
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewData["OwnedMachineId"] =
|
||||||
|
new
|
||||||
|
SelectList(_context.OwnedMachines.OrderBy(m => m.Machine.Company.Name).ThenBy(m => m.Machine.Name).ThenBy(m => m.User.UserName).Select(m => new {m.Id, Name = $"{m.Machine.Company.Name} {m.Machine.Name} <{m.User.UserName}>"}),
|
||||||
|
"Id", "Name", storageByOwnedMachine.OwnedMachineId);
|
||||||
|
return View(storageByOwnedMachine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: Admin/StorageByOwnedMachines/Delete/5
|
||||||
|
public async Task<IActionResult> Delete(long? id)
|
||||||
|
{
|
||||||
|
if(id == null) return NotFound();
|
||||||
|
|
||||||
|
StorageByMachineViewModel storageByOwnedMachine = await _context
|
||||||
|
.StorageByOwnedMachine
|
||||||
|
.OrderBy(s => s.OwnedMachine.Machine.Company.Name)
|
||||||
|
.ThenBy(s => s.OwnedMachine.Machine.Name)
|
||||||
|
.ThenBy(s => s.OwnedMachine.User.UserName)
|
||||||
|
.Select(s => new StorageByMachineViewModel
|
||||||
|
{
|
||||||
|
Id = s.Id,
|
||||||
|
Company =
|
||||||
|
s.OwnedMachine.Machine.Company
|
||||||
|
.Name,
|
||||||
|
Machine =
|
||||||
|
$"{s.OwnedMachine.Machine.Company.Name} {s.OwnedMachine.Machine.Name} <{s.OwnedMachine.User.UserName}>",
|
||||||
|
Type = s.Type,
|
||||||
|
Interface = s.Interface,
|
||||||
|
Capacity = s.Capacity
|
||||||
|
}).FirstOrDefaultAsync(m => m.Id == id);
|
||||||
|
if(storageByOwnedMachine == null) return NotFound();
|
||||||
|
|
||||||
|
return View(storageByOwnedMachine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: Admin/StorageByOwnedMachines/Delete/5
|
||||||
|
[HttpPost]
|
||||||
|
[ActionName("Delete")]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||||
|
{
|
||||||
|
StorageByOwnedMachine storageByOwnedMachine = await _context.StorageByOwnedMachine.FindAsync(id);
|
||||||
|
_context.StorageByOwnedMachine.Remove(storageByOwnedMachine);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return RedirectToAction(nameof(Index));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StorageByOwnedMachineExists(long id)
|
||||||
|
{
|
||||||
|
return _context.StorageByOwnedMachine.Any(e => e.Id == id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
// Copyright © 2003-2018 Natalia Portillo
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
}
|
}
|
||||||
@using cicm_web.Areas.Admin.Models
|
@using CompanyViewModel = cicm_web.Areas.Admin.Models.CompanyViewModel
|
||||||
@model IEnumerable<cicm_web.Areas.Admin.Models.CompanyViewModel>
|
@model IEnumerable<cicm_web.Areas.Admin.Models.CompanyViewModel>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
|
|||||||
@@ -16,13 +16,13 @@
|
|||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Extension.Extension)
|
@Html.DisplayFor(model => model.Extension.Extension)
|
||||||
</dd class>
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Processor)
|
@Html.DisplayNameFor(model => model.Processor)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Processor.Name)
|
@Html.DisplayFor(model => model.Processor.Name)
|
||||||
</dd class>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form asp-action="Delete">
|
<form asp-action="Delete">
|
||||||
|
|||||||
107
cicm_web/Areas/Admin/Views/StorageByOwnedMachines/Create.cshtml
Normal file
107
cicm_web/Areas/Admin/Views/StorageByOwnedMachines/Create.cshtml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
@{
|
||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Create.cshtml
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Admin view create
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
}
|
||||||
|
@using Cicm.Database
|
||||||
|
@model Cicm.Database.Models.StorageByOwnedMachine
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Create";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Create</h2>
|
||||||
|
|
||||||
|
<h4>Storage by machine</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="OwnedMachine"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<select asp-for="OwnedMachineId"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="ViewBag.OwnedMachineId">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Type"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<select asp-for="Type"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="Html.GetEnumSelectList<StorageType>().OrderBy(s => s.Text)">
|
||||||
|
</select>
|
||||||
|
<span asp-validation-for="Type"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Interface"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<select asp-for="Interface"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="Html.GetEnumSelectList<StorageInterface>().OrderBy(s => s.Text)">
|
||||||
|
</select>
|
||||||
|
<span asp-validation-for="Interface"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Capacity"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<input asp-for="Capacity"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="Capacity"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="btn btn-primary"
|
||||||
|
type="submit"
|
||||||
|
value="Create" />
|
||||||
|
<a asp-action="Index"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
@{
|
||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Delete.cshtml
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Admin view delete
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
}
|
||||||
|
@model cicm_web.Areas.Admin.Models.StorageByMachineViewModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Delete";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Delete</h2>
|
||||||
|
|
||||||
|
<h3>Are you sure you want to delete this?</h3>
|
||||||
|
<div>
|
||||||
|
<h4>Storage by machine</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Type)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Type)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Interface)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Interface)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Capacity)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Capacity)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Machine)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Machine)
|
||||||
|
</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"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
@{
|
||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Details.cshtml
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Admin view details
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
}
|
||||||
|
@model cicm_web.Areas.Admin.Models.StorageByMachineViewModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Details";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Details</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h4>Storage by machine</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Type)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Type)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Interface)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Interface)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Capacity)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Capacity)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Machine)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Machine)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a asp-action="Edit"
|
||||||
|
asp-route-id="@Model.Id"
|
||||||
|
class="btn btn-primary">
|
||||||
|
Edit
|
||||||
|
</a>
|
||||||
|
<a asp-action="Index"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
112
cicm_web/Areas/Admin/Views/StorageByOwnedMachines/Edit.cshtml
Normal file
112
cicm_web/Areas/Admin/Views/StorageByOwnedMachines/Edit.cshtml
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
@{
|
||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Edit.cshtml
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Admin view edit
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
}
|
||||||
|
@using Cicm.Database
|
||||||
|
@model Cicm.Database.Models.StorageByOwnedMachine
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Edit</h2>
|
||||||
|
|
||||||
|
<h4>Storage by machine</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="OwnedMachineId"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<select asp-for="OwnedMachineId"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="ViewBag.OwnedMachineId">
|
||||||
|
</select>
|
||||||
|
<span asp-validation-for="OwnedMachineId"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Type"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<select asp-for="Type"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="Html.GetEnumSelectList<StorageType>().OrderBy(s => s.Text)">
|
||||||
|
</select>
|
||||||
|
<span asp-validation-for="Type"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Interface"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<select asp-for="Interface"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="Html.GetEnumSelectList<StorageInterface>().OrderBy(s => s.Text)">
|
||||||
|
</select>
|
||||||
|
<span asp-validation-for="Interface"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Capacity"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<input asp-for="Capacity"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="Capacity"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input type="hidden"
|
||||||
|
asp-for="Id" />
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="btn btn-primary"
|
||||||
|
type="submit"
|
||||||
|
value="Save" />
|
||||||
|
<a asp-action="Index"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||||
|
}
|
||||||
107
cicm_web/Areas/Admin/Views/StorageByOwnedMachines/Index.cshtml
Normal file
107
cicm_web/Areas/Admin/Views/StorageByOwnedMachines/Index.cshtml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
@{
|
||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Index.cshtml
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Admin view index
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
}
|
||||||
|
@using cicm_web.Areas.Admin.Models
|
||||||
|
@model IEnumerable<cicm_web.Areas.Admin.Models.StorageByMachineViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Storage by machines (Admin)";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Storage by machines</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a asp-action="Create"
|
||||||
|
class="btn btn-primary">
|
||||||
|
Create New
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Company)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Machine)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Type)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Interface)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Capacity)
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach(StorageByMachineViewModel item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Company)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Machine)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Type)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Interface)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Capacity)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a asp-action="Details"
|
||||||
|
asp-route-id="@item.Id"
|
||||||
|
class="btn btn-primary">
|
||||||
|
Details
|
||||||
|
</a>
|
||||||
|
<a asp-action="Edit"
|
||||||
|
asp-route-id="@item.Id"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Edit
|
||||||
|
</a>
|
||||||
|
<a asp-action="Delete"
|
||||||
|
asp-route-id="@item.Id"
|
||||||
|
class="btn btn-danger">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
Reference in New Issue
Block a user