I have ASP.NET Core 3.1 MVC app and such controller definition:
public class MainController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IWeatherService _weatherService;
public MainController(ILogger<HomeController> logger, IWeatherService weatherService)
{
_logger = logger;
_weatherService = weatherService;
}
public IActionResult SelectCity()
{
return View();
}
[HttpPost]
public async Task<IActionResult> ShowChart([FromForm] SettelmentModel settelment)
{
var lat = double.Parse(settelment.Lat, CultureInfo.InvariantCulture);
var lon = double.Parse(settelment.Long, CultureInfo.InvariantCulture);
var data = await _weatherService.GetHistoricalForecast(lat, lon);
return View("ShowChart", data);
}
}
The app processes the ShowChart method and finds the ShowChart view, but does not open it in the browser. And just stays on the same View from ShowChart method was requested.
I expected it would route to /Main/Chart and would open the Chart view.
What I am doing wrong?

<form>in theSelectCityview, or do you POST toShowChartwith ajax?