Initial files
This commit is contained in:
commit
691e049103
65 changed files with 4312 additions and 0 deletions
43
Start/Server/Controllers/BookmarksController.cs
Normal file
43
Start/Server/Controllers/BookmarksController.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Start.Server.Data.Services.Interfaces;
|
||||
using Start.Server.Models;
|
||||
|
||||
namespace Start.Server.Controllers {
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class BookmarksController : ControllerBase {
|
||||
private readonly IBookmarkService bookmarkService;
|
||||
|
||||
public BookmarksController(IBookmarkService bookmarkService) {
|
||||
this.bookmarkService = bookmarkService;
|
||||
}
|
||||
|
||||
/*
|
||||
[HttpGet]
|
||||
public IList<BookmarkContainer> GetAllBookmarkContainers() {
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public BookmarkContainer GetBookmarkContainer(int bookmarkContainerId) {
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
[HttpPost]
|
||||
public Bookmark CreateBookmark(string title, string url, string? notes,
|
||||
int bookmarkGroupId) {
|
||||
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||
|
||||
return bookmarkService.CreateBookmark(userId, title, url, notes, bookmarkGroupId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
26
Start/Server/Controllers/OidcConfigurationController.cs
Normal file
26
Start/Server/Controllers/OidcConfigurationController.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Start.Server.Controllers
|
||||
{
|
||||
public class OidcConfigurationController : Controller
|
||||
{
|
||||
private readonly ILogger<OidcConfigurationController> _logger;
|
||||
|
||||
public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> logger)
|
||||
{
|
||||
ClientRequestParametersProvider = clientRequestParametersProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
|
||||
|
||||
[HttpGet("_configuration/{clientId}")]
|
||||
public IActionResult GetClientRequestParameters([FromRoute] string clientId)
|
||||
{
|
||||
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
|
||||
return Ok(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Start/Server/Controllers/WeatherForecastController.cs
Normal file
42
Start/Server/Controllers/WeatherForecastController.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Start.Shared;
|
||||
|
||||
namespace Start.Server.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue