I am using ASP.Net Core and MVC6 for development.I have an anchor tag with parameter in href where I am editing the form and redirecting it to another page but after get method getting call it calls post method also.It should not happen but why it's happening,
it makes no scene to call its get method and post method if I have same method name but have different parameter like below.
[HttpGet]
public IActionResult EditTemplate(int Id)
{
return RedirectToRoute("","");
}
[HttpPost]
pblic IActionResult EditTemplate(Template model)
{
//to prevent post here I am checking model value which is not used by parameter in get method
if(!string.IsNullOrEmpty(model.TemplateName))
{
return View(model);
}
}
What's the issue?. If anyone have any idea about please share your thought.
Thanks.
[HttpGet]
public IActionResult EditTemplate(int Id)
{
return RedirectToRoute("","");
}
[HttpPost]
pblic IActionResult EditTemplate(Template model)
{
//to prevent post here I am checking model value which is not used by parameter in get method
if(!string.IsNullOrEmpty(model.TemplateName))
{
return View(model);
}
}
What's the issue?. If anyone have any idea about please share your thought.
Thanks.