Formation settings
This commit is contained in:
122
Yavsc/Controllers/FormationSettingsController.cs
Normal file
122
Yavsc/Controllers/FormationSettingsController.cs
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Mvc;
|
||||||
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
|
using Microsoft.Data.Entity;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Workflow.Profiles;
|
||||||
|
|
||||||
|
namespace Yavsc.Controllers
|
||||||
|
{
|
||||||
|
public class FormationSettingsController : Controller
|
||||||
|
{
|
||||||
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
|
public FormationSettingsController(ApplicationDbContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: FormationSettings
|
||||||
|
public async Task<IActionResult> Index()
|
||||||
|
{
|
||||||
|
return View(await _context.FormationSettings.ToListAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: FormationSettings/Details/5
|
||||||
|
public async Task<IActionResult> Details(string id)
|
||||||
|
{
|
||||||
|
if (id == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
FormationSettings formationSettings = await _context.FormationSettings.SingleAsync(m => m.UserId == id);
|
||||||
|
if (formationSettings == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(formationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: FormationSettings/Create
|
||||||
|
public IActionResult Create()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: FormationSettings/Create
|
||||||
|
[HttpPost]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public async Task<IActionResult> Create(FormationSettings formationSettings)
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
_context.FormationSettings.Add(formationSettings);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
return View(formationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: FormationSettings/Edit/5
|
||||||
|
public async Task<IActionResult> Edit(string id)
|
||||||
|
{
|
||||||
|
if (id == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
FormationSettings formationSettings = await _context.FormationSettings.SingleAsync(m => m.UserId == id);
|
||||||
|
if (formationSettings == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
return View(formationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: FormationSettings/Edit/5
|
||||||
|
[HttpPost]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public async Task<IActionResult> Edit(FormationSettings formationSettings)
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
_context.Update(formationSettings);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
return View(formationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: FormationSettings/Delete/5
|
||||||
|
[ActionName("Delete")]
|
||||||
|
public async Task<IActionResult> Delete(string id)
|
||||||
|
{
|
||||||
|
if (id == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
FormationSettings formationSettings = await _context.FormationSettings.SingleAsync(m => m.UserId == id);
|
||||||
|
if (formationSettings == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(formationSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: FormationSettings/Delete/5
|
||||||
|
[HttpPost, ActionName("Delete")]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||||
|
{
|
||||||
|
FormationSettings formationSettings = await _context.FormationSettings.SingleAsync(m => m.UserId == id);
|
||||||
|
_context.FormationSettings.Remove(formationSettings);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
Yavsc/Views/FormationSettings/Create.cshtml
Normal file
25
Yavsc/Views/FormationSettings/Create.cshtml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
@model Yavsc.Models.Workflow.Profiles.FormationSettings
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Create";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Create</h2>
|
||||||
|
|
||||||
|
<form asp-action="Create">
|
||||||
|
<div class="form-horizontal">
|
||||||
|
<h4>FormationSettings</h4>
|
||||||
|
<hr />
|
||||||
|
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-offset-2 col-md-10">
|
||||||
|
<input type="submit" value="Create" class="btn btn-default" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
|
|
22
Yavsc/Views/FormationSettings/Delete.cshtml
Normal file
22
Yavsc/Views/FormationSettings/Delete.cshtml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
@model Yavsc.Models.Workflow.Profiles.FormationSettings
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Delete";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Delete</h2>
|
||||||
|
|
||||||
|
<h3>Are you sure you want to delete this?</h3>
|
||||||
|
<div>
|
||||||
|
<h4>FormationSettings</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<form asp-action="Delete">
|
||||||
|
<div class="form-actions no-color">
|
||||||
|
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
18
Yavsc/Views/FormationSettings/Details.cshtml
Normal file
18
Yavsc/Views/FormationSettings/Details.cshtml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
@model Yavsc.Models.Workflow.Profiles.FormationSettings
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Details";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Details</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h4>FormationSettings</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<a asp-action="Edit" asp-route-id="@Model.UserId">Edit</a> |
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</p>
|
26
Yavsc/Views/FormationSettings/Edit.cshtml
Normal file
26
Yavsc/Views/FormationSettings/Edit.cshtml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
@model Yavsc.Models.Workflow.Profiles.FormationSettings
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Edit</h2>
|
||||||
|
|
||||||
|
<form asp-action="Edit">
|
||||||
|
<div class="form-horizontal">
|
||||||
|
<h4>FormationSettings</h4>
|
||||||
|
<hr />
|
||||||
|
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||||
|
<input type="hidden" asp-for="UserId" />
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-offset-2 col-md-10">
|
||||||
|
<input type="submit" value="Save" class="btn btn-default" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
|
|
26
Yavsc/Views/FormationSettings/Index.cshtml
Normal file
26
Yavsc/Views/FormationSettings/Index.cshtml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
@model IEnumerable<Yavsc.Models.Workflow.Profiles.FormationSettings>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Index";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Index</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a asp-action="Create">Create New</a>
|
||||||
|
</p>
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@foreach (var item in Model) {
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a asp-action="Edit" asp-route-id="@item.UserId">Edit</a> |
|
||||||
|
<a asp-action="Details" asp-route-id="@item.UserId">Details</a> |
|
||||||
|
<a asp-action="Delete" asp-route-id="@item.UserId">Delete</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
Reference in New Issue
Block a user