diff --git a/cicm_web/Areas/Admin/Controllers/BrowserTestsController.cs b/cicm_web/Areas/Admin/Controllers/BrowserTestsController.cs index 7d1cb782..858f9051 100644 --- a/cicm_web/Areas/Admin/Controllers/BrowserTestsController.cs +++ b/cicm_web/Areas/Admin/Controllers/BrowserTestsController.cs @@ -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 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 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 diff --git a/cicm_web/Areas/Admin/Views/BrowserTests/Create.cshtml b/cicm_web/Areas/Admin/Views/BrowserTests/Create.cshtml deleted file mode 100644 index 40a0087e..00000000 --- a/cicm_web/Areas/Admin/Views/BrowserTests/Create.cshtml +++ /dev/null @@ -1,63 +0,0 @@ -@{ - /****************************************************************************** -// Canary Islands Computer Museum Website -// ---------------------------------------------------------------------------- -// -// Filename : Create.cshtml -// Author(s) : Natalia Portillo -// -// --[ 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 . -// -// ---------------------------------------------------------------------------- -// Copyright © 2003-2018 Natalia Portillo -*******************************************************************************/ -} -@model Cicm.Database.Models.BrowserTest - -@{ - ViewData["Title"] = "Create"; -} - -

Create

- -

Browser test

-
-
-
-
-
-
- -
-
-
- -@section Scripts { - @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } -} \ No newline at end of file diff --git a/cicm_web/Areas/Admin/Views/BrowserTests/Index.cshtml b/cicm_web/Areas/Admin/Views/BrowserTests/Index.cshtml index 61d5f387..249bb020 100644 --- a/cicm_web/Areas/Admin/Views/BrowserTests/Index.cshtml +++ b/cicm_web/Areas/Admin/Views/BrowserTests/Index.cshtml @@ -38,12 +38,6 @@

Browser tests

-

- - Create New - -