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.Events;
using Microsoft.SelfService.Portal.Core.API.Events.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ServiceController : Controller
{
private readonly IMapper _mapper;
private readonly IServiceInterface _serviceInterface;
public ServiceController(IMapper mapper, IServiceInterface serviceInterface)
{
_mapper = mapper;
_serviceInterface = serviceInterface;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<ServiceModel>))]
public IActionResult GetServices()
{
var services = _mapper.Map<List<GetServiceDto>>(_serviceInterface.GetServices());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(services);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(ServiceModel))]
public IActionResult GetServiceById(Guid Id)
{
if(!_serviceInterface.CheckServiceById(Id))
return NotFound();
var service = _mapper.Map<GetServiceDetailsDto>(_serviceInterface.GetServiceById(Id));
if(!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(service);
}
}
}