Remove old API controllers.

This commit is contained in:
2020-05-31 19:13:04 +01:00
parent 9d55f327f0
commit a99dbbd359
3 changed files with 0 additions and 192 deletions

View File

@@ -1,64 +0,0 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Filename : CompaniesController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Companies api controller
//
// --[ 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-2020 Natalia Portillo
*******************************************************************************/
using System.Collections.Generic;
using System.Threading.Tasks;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Mvc;
namespace Marechai.Areas.Api.Controllers
{
[Route("api/[controller]"), ApiController]
public class CompaniesController : ControllerBase
{
readonly MarechaiContext _context;
public CompaniesController(MarechaiContext context) => _context = context;
// GET: api/Companies
[HttpGet]
public IEnumerable<Company> GetCompanies() => _context.Companies;
// GET: api/Companies/5
[HttpGet("{id}")]
public async Task<IActionResult> GetCompany([FromRoute] int id)
{
if(!ModelState.IsValid)
return BadRequest(ModelState);
Company company = await _context.Companies.FindAsync(id);
if(company == null)
return NotFound();
return Ok(company);
}
}
}

View File

@@ -1,64 +0,0 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Filename : MachinesController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Machines api controller
//
// --[ 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-2020 Natalia Portillo
*******************************************************************************/
using System.Collections.Generic;
using System.Threading.Tasks;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Mvc;
namespace Marechai.Areas.Api.Controllers
{
[Route("api/[controller]"), ApiController]
public class MachinesController : ControllerBase
{
readonly MarechaiContext _context;
public MachinesController(MarechaiContext context) => _context = context;
// GET: api/Machines
[HttpGet]
public IEnumerable<Machine> GetMachines() => _context.Machines;
// GET: api/Machines/5
[HttpGet("{id}")]
public async Task<IActionResult> GetMachine([FromRoute] int id)
{
if(!ModelState.IsValid)
return BadRequest(ModelState);
Machine machine = await _context.Machines.FindAsync(id);
if(machine == null)
return NotFound();
return Ok(machine);
}
}
}

View File

@@ -1,64 +0,0 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Filename : NewsController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// News api controller
//
// --[ 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-2020 Natalia Portillo
*******************************************************************************/
using System.Collections.Generic;
using System.Threading.Tasks;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Mvc;
namespace Marechai.Areas.Api.Controllers
{
[Route("api/[controller]"), ApiController]
public class NewsController : ControllerBase
{
readonly MarechaiContext _context;
public NewsController(MarechaiContext context) => _context = context;
// GET: api/News
[HttpGet]
public IEnumerable<News> GetNews() => _context.News;
// GET: api/News/5
[HttpGet("{id}")]
public async Task<IActionResult> GetNews([FromRoute] int id)
{
if(!ModelState.IsValid)
return BadRequest(ModelState);
News news = await _context.News.FindAsync(id);
if(news == null)
return NotFound();
return Ok(news);
}
}
}