I'm learning MVC Core 2, from two different instructors.
One instructor posts with the [HTTPPOST] attribute, while the other
codes the action with async Task<IactionResult>
Do they basically do the same thing?
E.G., Instructor 1:
[HttpPost]
public IActionResult Checkout(Order order)
{
....
return RedirectToAction(nameof(Completed));
}
else
{
return View(order);
}
Instructor 2:
public async Task<IActionResult> Create(cls_a a)
{
....
{
mydb.Add(serviceType);
await mydb.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
}
return View(serviceType);
}