Gerações NIF NISS

This commit is contained in:
SECUNDIS\masantos
2024-04-10 19:42:13 +01:00
parent 2b99972e01
commit be60a4df8e
14 changed files with 442 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using Microsoft.AspNetCore.Mvc;
using GeradoresService;
namespace GeradoresWS.Controllers
{
[ApiController]
[Route("[controller]")]
public class GenerateController : Controller
{
#region NIF
[HttpGet("GenerateNIF")]
public string GenerateNIF(string? type)
{
return NIF.Generate(type);
}
[HttpGet("ValidateNIF")]
public bool ValidateNIF(string nif)
{
return NIF.Validate(nif);
}
#endregion
#region NISS
[HttpGet("GenerateNISS")]
public string GenerateNISS()
{
return NISS.Generate();
}
[HttpGet("ValidateNISS")]
public bool ValidateNISS(string nif)
{
return NISS.Validate(nif);
}
#endregion
}
}

View File

@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;
namespace GeradoresWS.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(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}