Intial commit. THe bare bones of a REST .NET Core app have been made.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using SecureCore.Services;
|
||||
|
||||
namespace SecureCore.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class EmployeeController : Controller
|
||||
{
|
||||
private readonly IDataService DataService;
|
||||
|
||||
|
||||
public EmployeeController(IDataService dataService)
|
||||
{
|
||||
DataService = dataService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Get()
|
||||
{
|
||||
return Ok(DataService.Get());
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "Get")]
|
||||
public IActionResult Get(int id)
|
||||
{
|
||||
return Ok(DataService.GetById(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user