Intial commit. THe bare bones of a REST .NET Core app have been made.

This commit is contained in:
2021-01-01 00:57:07 -08:00
commit 26c59555ab
81 changed files with 12064 additions and 0 deletions
@@ -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));
}
}
}
@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SecureCore.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}