mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Implement edit owned machine admin page.
This commit is contained in:
@@ -117,7 +117,14 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
OwnedMachine ownedMachine = await _context.OwnedMachines.FindAsync(id);
|
OwnedMachine ownedMachine = await _context.OwnedMachines.FindAsync(id);
|
||||||
if(ownedMachine == null) return NotFound();
|
if(ownedMachine == null) return NotFound();
|
||||||
|
|
||||||
ViewData["MachineId"] = new SelectList(_context.Machines, "Id", "Name", ownedMachine.MachineId);
|
ViewData["MachineId"] =
|
||||||
|
new
|
||||||
|
SelectList(_context.Machines.OrderBy(m => m.Company.Name).ThenBy(m => m.Name).Select(m => new {m.Id, Name = $"{m.Company.Name} {m.Name}"}),
|
||||||
|
"Id", "Name");
|
||||||
|
ViewData["UserId"] =
|
||||||
|
new
|
||||||
|
SelectList(_context.Users.OrderBy(u => u.UserName).Where(u => u.Id == ownedMachine.UserId).Select(u => new {u.Id, u.UserName}),
|
||||||
|
"Id", "UserName");
|
||||||
return View(ownedMachine);
|
return View(ownedMachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +157,14 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
return RedirectToAction(nameof(Index));
|
return RedirectToAction(nameof(Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewData["MachineId"] = new SelectList(_context.Machines, "Id", "Name", ownedMachine.MachineId);
|
ViewData["MachineId"] =
|
||||||
|
new
|
||||||
|
SelectList(_context.Machines.OrderBy(m => m.Company.Name).ThenBy(m => m.Name).Select(m => new {m.Id, Name = $"{m.Company.Name} {m.Name}"}),
|
||||||
|
"Id", "Name");
|
||||||
|
ViewData["UserId"] =
|
||||||
|
new
|
||||||
|
SelectList(_context.Users.OrderBy(u => u.UserName).Where(u => u.Id == ownedMachine.UserId).Select(u => new {u.Id, u.UserName}),
|
||||||
|
"Id", "UserName");
|
||||||
return View(ownedMachine);
|
return View(ownedMachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@using Cicm.Database
|
||||||
@model Cicm.Database.Models.OwnedMachine
|
@model Cicm.Database.Models.OwnedMachine
|
||||||
|
|
||||||
@{
|
@{
|
||||||
@@ -6,71 +7,125 @@
|
|||||||
|
|
||||||
<h1>Edit</h1>
|
<h1>Edit</h1>
|
||||||
|
|
||||||
<h4>OwnedMachine</h4>
|
<h4>Owned machine</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form asp-action="Edit">
|
<form asp-action="Edit">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly"
|
||||||
<div class="form-group">
|
class="text-danger">
|
||||||
<label asp-for="AcquisitionDate" class="control-label"></label>
|
|
||||||
<input asp-for="AcquisitionDate" class="form-control" />
|
|
||||||
<span asp-validation-for="AcquisitionDate" class="text-danger"></span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="LostDate" class="control-label"></label>
|
<label asp-for="AcquisitionDate"
|
||||||
<input asp-for="LostDate" class="form-control" />
|
class="control-label">
|
||||||
<span asp-validation-for="LostDate" class="text-danger"></span>
|
</label>
|
||||||
|
<input asp-for="AcquisitionDate"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="AcquisitionDate"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Status" class="control-label"></label>
|
<label asp-for="LostDate"
|
||||||
<select asp-for="Status" class="form-control"></select>
|
class="control-label">
|
||||||
<span asp-validation-for="Status" class="text-danger"></span>
|
</label>
|
||||||
|
<input asp-for="LostDate"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="LostDate"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="LastStatusDate" class="control-label"></label>
|
<label asp-for="Status"
|
||||||
<input asp-for="LastStatusDate" class="form-control" />
|
class="control-label">
|
||||||
<span asp-validation-for="LastStatusDate" class="text-danger"></span>
|
</label>
|
||||||
|
<select asp-for="Status"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="Html.GetEnumSelectList<StatusType>().OrderBy(s => s.Text)">
|
||||||
|
</select>
|
||||||
|
<span asp-validation-for="Status"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-check">
|
<div class="form-group">
|
||||||
|
<label asp-for="LastStatusDate"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<input asp-for="LastStatusDate"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="LastStatusDate"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-group">
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
<input class="form-check-input" asp-for="Trade" /> @Html.DisplayNameFor(model => model.Trade)
|
<input class="form-check-input"
|
||||||
|
asp-for="Trade" /> @Html.DisplayNameFor(model => model.Trade)
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-check">
|
<div class="form-check form-group">
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
<input class="form-check-input" asp-for="Boxed" /> @Html.DisplayNameFor(model => model.Boxed)
|
<input class="form-check-input"
|
||||||
|
asp-for="Boxed" /> @Html.DisplayNameFor(model => model.Boxed)
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-check">
|
<div class="form-check form-group">
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
<input class="form-check-input" asp-for="Manuals" /> @Html.DisplayNameFor(model => model.Manuals)
|
<input class="form-check-input"
|
||||||
|
asp-for="Manuals" /> @Html.DisplayNameFor(model => model.Manuals)
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="SerialNumber" class="control-label"></label>
|
<label asp-for="SerialNumber"
|
||||||
<input asp-for="SerialNumber" class="form-control" />
|
class="control-label">
|
||||||
<span asp-validation-for="SerialNumber" class="text-danger"></span>
|
</label>
|
||||||
|
<input asp-for="SerialNumber"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="SerialNumber"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-check">
|
<div class="form-check form-group">
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
<input class="form-check-input" asp-for="SerialNumberVisible" /> @Html.DisplayNameFor(model => model.SerialNumberVisible)
|
<input class="form-check-input"
|
||||||
|
asp-for="SerialNumberVisible"
|
||||||
|
checked /> @Html.DisplayNameFor(model => model.SerialNumberVisible)
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="MachineId" class="control-label"></label>
|
<label asp-for="Machine"
|
||||||
<select asp-for="MachineId" class="form-control" asp-items="ViewBag.MachineId"></select>
|
class="control-label">
|
||||||
<span asp-validation-for="MachineId" class="text-danger"></span>
|
</label>
|
||||||
|
<select asp-for="MachineId"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="ViewBag.MachineId">
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" asp-for="Id" />
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="submit" value="Save" class="btn btn-primary" />
|
<label asp-for="User"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<select asp-for="UserId"
|
||||||
|
class="form-control"
|
||||||
|
asp-items="ViewBag.UserId"
|
||||||
|
readonly>
|
||||||
|
</select>
|
||||||
|
</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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
@section Scripts {
|
||||||
<a asp-action="Index">Back to List</a>
|
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||||
</div>
|
}
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<Version>3.0.99.684</Version>
|
<Version>3.0.99.685</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user