big day behind me
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-05-19 04:33:53 +02:00
parent 4d4455679c
commit 8347b10401
36 changed files with 2291 additions and 284 deletions

View File

@ -0,0 +1,38 @@
using HanyadikHetVan.DTO;
using HanyadikHetVan.Services;
using Microsoft.AspNetCore.Mvc;
using System.Net.Mime;
namespace HanyadikHetVan.Controllers.V1
{
[ApiController]
[ApiVersion("1.0")]
[Route("api/v{version:apiVersion}/[controller]")]
public class HanyadikHetVanController : Controller
{
private readonly HanyadikHetVanJsonService _jsonservice;
private readonly HanyadikHetVanService _service;
public HanyadikHetVanController(HanyadikHetVanJsonService jsonservice, HanyadikHetVanService service)
{
_jsonservice = jsonservice;
_service = service;
}
[HttpGet("json")]
[Consumes(MediaTypeNames.Application.Json)]
[Produces(MediaTypeNames.Application.Json)]
public HanyadikHetVanDTO GetJson()
{
return _jsonservice.HanyadikHetVan();
}
[HttpGet]
public int Get()
{
return _service.HanyadikHetVan();
}
}
}

View File

@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Security.Claims;
namespace HanyadikHetVan.Controllers.V1
{
[ApiVersion("1.0")]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiController]
public class TestController : Controller
{
private UserManager<IdentityUser> _userManager;
public TestController(UserManager<IdentityUser> userManager)
{
_userManager = userManager ?? throw new ArgumentNullException(nameof(userManager));
}
[HttpGet("unprotected")]
[Produces("application/json")]
public string Unprotected()
{
return "Unprotected";
}
[Authorize]
[HttpGet("protected")]
[Produces("application/json")]
public string Protected()
{
return this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
}
}
}