diff --git a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Controllers/WeatherForecastController.cs b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Controllers/WeatherForecastController.cs index 3edfb2b59f..a3f12a2731 100644 --- a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Controllers/WeatherForecastController.cs +++ b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Controllers/WeatherForecastController.cs @@ -20,6 +20,8 @@ namespace BindTryParseAPI.Controllers _logger = logger; } + // + // GET /WeatherForecast?culture=en-GB [HttpGet] public IActionResult Get([FromQuery] Culture? culture) { @@ -40,7 +42,10 @@ namespace BindTryParseAPI.Controllers return Ok(weatherForecasts); } + // + // + // GET /WeatherForecast/GetByRange?range=07/12/2022-07/14/2022 [HttpGet] [Route("GetByRange")] public IActionResult Range([FromQuery] DateRange? range) @@ -63,5 +68,6 @@ namespace BindTryParseAPI.Controllers return Ok(weatherForecasts); } + // } } diff --git a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Models/Culture.cs b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Models/Culture.cs index e45e12a41f..9ac1f511c2 100644 --- a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Models/Culture.cs +++ b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Models/Culture.cs @@ -1,5 +1,6 @@ namespace BindTryParseAPI.Models { + // public class Culture { public string? DisplayName { get; } @@ -24,4 +25,5 @@ namespace BindTryParseAPI.Models return true; } } + // } diff --git a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Models/DateRange.cs b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Models/DateRange.cs index 48cce7023c..f7d31596f2 100644 --- a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Models/DateRange.cs +++ b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseAPI/Models/DateRange.cs @@ -1,5 +1,6 @@ namespace BindTryParseAPI.Models { + // public class DateRange { public DateOnly? From { get; } @@ -29,4 +30,5 @@ namespace BindTryParseAPI.Models return true; } } + // } diff --git a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Controllers/WeatherForecastController.cs b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Controllers/WeatherForecastController.cs index c65be83a62..03affc111a 100644 --- a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Controllers/WeatherForecastController.cs +++ b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Controllers/WeatherForecastController.cs @@ -11,11 +11,8 @@ namespace BindTryParseMVC.Controllers "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; - /// - /// /WeatherForecast?culture=en-GB - /// - /// - /// + // + //GET /WeatherForecast?culture=en-GB public IActionResult Index(Culture? culture) { var weatherForecasts = Enumerable @@ -35,12 +32,10 @@ namespace BindTryParseMVC.Controllers return View(weatherForecasts); } + // - /// - /// /WeatherForecast/Range?range=07/12/2022-07/14/2022 - /// - /// - /// + // GET /WeatherForecast/Range?range=07/12/2022-07/14/2022 + // public IActionResult Range(DateRange? range) { var weatherForecasts = Enumerable @@ -50,7 +45,8 @@ namespace BindTryParseMVC.Controllers TemperatureC = Random.Shared.Next(-20, 55), Summary = Summaries[Random.Shared.Next(Summaries.Length)] }) - .Where(wf => DateOnly.FromDateTime(wf.Date) >= (range?.From ?? DateOnly.MinValue) && DateOnly.FromDateTime(wf.Date) <= (range?.To ?? DateOnly.MaxValue)) + .Where(wf => DateOnly.FromDateTime(wf.Date) >= (range?.From ?? DateOnly.MinValue) + && DateOnly.FromDateTime(wf.Date) <= (range?.To ?? DateOnly.MaxValue)) .Select(wf => new WeatherForecastViewModel { Date = wf.Date.ToString(CultureInfo.InvariantCulture), @@ -61,5 +57,6 @@ namespace BindTryParseMVC.Controllers return View("Index", weatherForecasts); } + // } } diff --git a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Models/Culture.cs b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Models/Culture.cs index c762e94070..b948136ee2 100644 --- a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Models/Culture.cs +++ b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Models/Culture.cs @@ -1,5 +1,6 @@ namespace BindTryParseMVC.Models { + // public class Culture { public string? DisplayName { get; } @@ -24,4 +25,5 @@ namespace BindTryParseMVC.Models return true; } } + // } diff --git a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Models/DateRange.cs b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Models/DateRange.cs index 23195680d5..eb0e364a1a 100644 --- a/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Models/DateRange.cs +++ b/aspnetcore/mvc/controllers/bind-tryparse/7.0-samples/BindUsingTryParse/BindTryParseMVC/Models/DateRange.cs @@ -1,5 +1,6 @@ namespace BindTryParseMVC.Models { + // public class DateRange { public DateOnly? From { get; } @@ -29,4 +30,5 @@ namespace BindTryParseMVC.Models return true; } } + // }