Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Question about difference between HTTPPOST and async Task

$
0
0

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);
}


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>