AspNetCore.Docs.Samples/mvc/models/BindTryParseAPI/Program.cs

16 lines
414 B
C#
Raw Normal View History

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
var app = builder.Build();
2022-07-16 06:24:39 +08:00
var uri = "/WeatherForecast/GetByRange?range=" +
$"{DateTime.Now.Date.ToShortDateString()}-" +
$"{DateTime.Now.AddDays(5).Date.ToShortDateString()}";
app.MapGet("/", () => Results.Redirect(uri));
app.UseAuthorization();
app.MapControllers();
app.Run();