This commit is contained in:
David Štaleker
2025-07-18 05:33:16 +02:00
parent 401a367e5d
commit db0cc8d3de
14776 changed files with 9251484 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
@page
@model EveryThing.Pages.CodeTableJobs.CreateModel
@{
ViewData["Title"] = "Create";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<h1>Create</h1>
<h4>Job</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="Job.IdCompanyFk" class="control-label"></label>
<select asp-for="Job.IdCompanyFk" class ="form-control" asp-items="ViewBag.IdCompanyFk"></select>
</div>
<div class="form-group">
<label asp-for="Job.Title" class="control-label"></label>
<input asp-for="Job.Title" class="form-control" />
<span asp-validation-for="Job.Title" class="text-danger"></span>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Job.Active" /> @Html.DisplayNameFor(model => model.Job.Active)
</label>
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-page="Index">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.CodeTableJobs
{
public class CreateModel : PageModel
{
private readonly ApplicationDbContext _context;
public CreateModel(ApplicationDbContext context)
{
_context = context;
}
public IActionResult OnGet()
{
ViewData["IdCompanyFk"] = new SelectList(_context.CodeTableCompanies, "IdCompany", "Title");
return Page();
}
[BindProperty]
public CodeTableJob Job { get; set; }
// To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid)
{
return Page();
}
_context.CodeTableJobs.Add(Job);
await _context.SaveChangesAsync();
return RedirectToPage("./Index");
}
}
}

View File

@@ -0,0 +1,41 @@
@page
@model EveryThing.Pages.CodeTableJobs.DeleteModel
@{
ViewData["Title"] = "Delete";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<h1>Delete</h1>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Job</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Job.Title)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Job.Title)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Job.Active)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Job.Active)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Job.Company)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Job.Company.Ceo)
</dd>
</dl>
<form method="post">
<input type="hidden" asp-for="Job.IdJob" />
<input type="submit" value="Delete" class="btn btn-danger" /> |
<a asp-page="./Index">Back to List</a>
</form>
</div>

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.CodeTableJobs
{
public class DeleteModel : PageModel
{
private readonly ApplicationDbContext _context;
public DeleteModel(ApplicationDbContext context)
{
_context = context;
}
[BindProperty]
public CodeTableJob Job { get; set; }
public async Task<IActionResult> OnGetAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Job = await _context.CodeTableJobs
.Include(j => j.Company).FirstOrDefaultAsync(m => m.IdJob == id);
if (Job == null)
{
return NotFound();
}
return Page();
}
public async Task<IActionResult> OnPostAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Job = await _context.CodeTableJobs.FindAsync(id);
if (Job != null)
{
_context.CodeTableJobs.Remove(Job);
await _context.SaveChangesAsync();
}
return RedirectToPage("./Index");
}
}
}

View File

@@ -0,0 +1,38 @@
@page
@model EveryThing.Pages.CodeTableJobs.DetailsModel
@{
ViewData["Title"] = "Details";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<h1>Details</h1>
<div>
<h4>Job</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Job.Title)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Job.Title)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Job.Active)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Job.Active)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Job.Company)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Job.Company.Ceo)
</dd>
</dl>
</div>
<div>
<a asp-page="./Edit" asp-route-id="@Model.Job.IdJob">Edit</a> |
<a asp-page="./Index">Back to List</a>
</div>

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.CodeTableJobs
{
public class DetailsModel : PageModel
{
private readonly ApplicationDbContext _context;
public DetailsModel(ApplicationDbContext context)
{
_context = context;
}
public CodeTableJob Job { get; set; }
public async Task<IActionResult> OnGetAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Job = await _context.CodeTableJobs
.Include(j => j.Company).FirstOrDefaultAsync(m => m.IdJob == id);
if (Job == null)
{
return NotFound();
}
return Page();
}
}
}

View File

@@ -0,0 +1,46 @@
@page
@model EveryThing.Pages.CodeTableJobs.EditModel
@{
ViewData["Title"] = "Edit";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<h1>Edit</h1>
<h4>Job</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="Job.IdJob" />
<div class="form-group">
<label asp-for="Job.IdCompanyFk" class="control-label"></label>
<select asp-for="Job.IdCompanyFk" class="form-control" asp-items="ViewBag.IdCompanyFk"></select>
<span asp-validation-for="Job.IdCompanyFk" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Job.Title" class="control-label"></label>
<input asp-for="Job.Title" class="form-control" />
<span asp-validation-for="Job.Title" class="text-danger"></span>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Job.Active" /> @Html.DisplayNameFor(model => model.Job.Active)
</label>
</div>
<div class="form-group">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-page="./Index">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.CodeTableJobs
{
public class EditModel : PageModel
{
private readonly ApplicationDbContext _context;
public EditModel(ApplicationDbContext context)
{
_context = context;
}
[BindProperty]
public CodeTableJob Job { get; set; }
public async Task<IActionResult> OnGetAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Job = await _context.CodeTableJobs
.Include(j => j.Company).FirstOrDefaultAsync(m => m.IdJob == id);
if (Job == null)
{
return NotFound();
}
ViewData["IdCompanyFk"] = new SelectList(_context.CodeTableCompanies, "IdCompany", "Ceo");
return Page();
}
// To protect from overposting attacks, enable the specific properties you want to bind to.
// For more details, see https://aka.ms/RazorPagesCRUD.
public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid)
{
return Page();
}
_context.Attach(Job).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!JobExists(Job.IdJob))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToPage("./Index");
}
private bool JobExists(int id)
{
return _context.CodeTableJobs.Any(e => e.IdJob == id);
}
}
}

View File

@@ -0,0 +1,49 @@
@page
@model EveryThing.Pages.CodeTableJobs.IndexModel
@{
ViewData["Title"] = "Index";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<h1>Index</h1>
<p>
<a asp-page="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Job[0].Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Job[0].Active)
</th>
<th>
@Html.DisplayNameFor(model => model.Job[0].Company)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Job) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.Active)
</td>
<td>
@Html.DisplayFor(modelItem => item.Company.Ceo)
</td>
<td>
<a asp-page="./Edit" asp-route-id="@item.IdJob">Edit</a> |
<a asp-page="./Details" asp-route-id="@item.IdJob">Details</a> |
<a asp-page="./Delete" asp-route-id="@item.IdJob">Delete</a>
</td>
</tr>
}
</tbody>
</table>

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.CodeTableJobs
{
public class IndexModel : PageModel
{
private readonly ApplicationDbContext _context;
public IndexModel(ApplicationDbContext context)
{
_context = context;
}
public IList<CodeTableJob> Job { get;set; }
public async Task OnGetAsync()
{
Job = await _context.CodeTableJobs
.Include(j => j.Company).ToListAsync();
}
}
}