initial commit

This commit is contained in:
2026-04-15 15:02:32 +02:00
commit 3bfc79e6d9
1380 changed files with 69684 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.Service.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Template.Get;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
using System.Reflection;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class TemplateController : Controller
{
private readonly ITemplateInterface _templateInterface;
private readonly IMapper _mapper;
public TemplateController(ITemplateInterface templateInterface, IMapper mapper)
{
_templateInterface = templateInterface;
_mapper = mapper;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<TemplateModel>))]
public IActionResult GetTemplates()
{
var templates = _mapper.Map<List<GetTemplateDto>>(_templateInterface.GetTemplates());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(templates);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(TemplateModel))]
public IActionResult GetTemplateById(Guid Id)
{
if (!_templateInterface.CheckTemplateById(Id))
return NotFound();
var template = _mapper.Map<GetTemplateDetailsDto>(_templateInterface.GetTemplateById(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(template);
}
}
}