mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Do not allow to create browser tests.
This commit is contained in:
@@ -62,29 +62,6 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
return View(browserTest);
|
||||
}
|
||||
|
||||
// GET: Admin/BrowserTests/Create
|
||||
public IActionResult Create() => View();
|
||||
|
||||
// POST: Admin/BrowserTests/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(
|
||||
"Id,UserAgent,Browser,Version,Os,Platform,Gif87,Gif89,Jpeg,Png,Pngt,Agif,Table,Colors,Js,Frames,Flash")]
|
||||
BrowserTest browserTest)
|
||||
{
|
||||
if(ModelState.IsValid)
|
||||
{
|
||||
_context.Add(browserTest);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
return View(browserTest);
|
||||
}
|
||||
|
||||
// GET: Admin/BrowserTests/Edit/5
|
||||
public async Task<IActionResult> Edit(int? id)
|
||||
{
|
||||
@@ -108,24 +85,21 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
{
|
||||
if(id != browserTest.Id) return NotFound();
|
||||
|
||||
if(ModelState.IsValid)
|
||||
if(!ModelState.IsValid) return View(browserTest);
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
_context.Update(browserTest);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch(DbUpdateConcurrencyException)
|
||||
{
|
||||
if(!BrowserTestExists(browserTest.Id)) return NotFound();
|
||||
_context.Update(browserTest);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch(DbUpdateConcurrencyException)
|
||||
{
|
||||
if(!BrowserTestExists(browserTest.Id)) return NotFound();
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
throw;
|
||||
}
|
||||
|
||||
return View(browserTest);
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
// GET: Admin/BrowserTests/Delete/5
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
@{
|
||||
/******************************************************************************
|
||||
// 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
|
||||
*******************************************************************************/
|
||||
}
|
||||
@model Cicm.Database.Models.BrowserTest
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Create";
|
||||
}
|
||||
|
||||
<h2>Create</h2>
|
||||
|
||||
<h4>Browser test</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">
|
||||
<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"); }
|
||||
}
|
||||
@@ -38,12 +38,6 @@
|
||||
|
||||
<h2>Browser tests</h2>
|
||||
|
||||
<p>
|
||||
<a asp-action="Create"
|
||||
class="btn btn-primary">
|
||||
Create New
|
||||
</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user