/Code/Source/Teaching.Threading.Web/Controllers/Mvc3AsyncController.cs
C# | 29 lines | 26 code | 3 blank | 0 comment | 0 complexity | b7a8c4467f4f0e849f0aee4c32afba4c MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- using System.Threading.Tasks;
- using System.Web.Http;
- using System.Web.Mvc;
-
- namespace Teaching.Threading.Web.Controllers
- {
- public class Mvc3AsyncController : AsyncController
- {
- public void IndexAsync()
- {
- AsyncManager.OutstandingOperations.Increment();
-
- Task.Delay(5000).ContinueWith(t =>
- {
- AsyncManager.Parameters["someParameter"] = 5;
- AsyncManager.OutstandingOperations.Decrement();
- });
- }
-
- public ActionResult IndexCompleted( int someParameter )
- {
- return View();
- }
- }
- }