Ejemplo n.º 1
0
        public IActionResult Index([FromServices] ITransientDateService transientDateService2)
        {
            ViewBag.time1 = _transientDateService.GetDateTime.TimeOfDay.ToString();

            ViewBag.time2 = transientDateService2.GetDateTime.TimeOfDay.ToString();

            return(View());
        }
Ejemplo n.º 2
0
 public IActionResult Index
 (
     // [FromServices] ISingletonDateService singletonDateService2
     // [FromServices] IScopedDateService scopedDateService2)
     [FromServices] ITransientDateService transientDateService2)
 {
     ViewBag.Time1 = _transientDateService.GetDateTime.TimeOfDay.ToString();
     ViewBag.Time2 = transientDateService2.GetDateTime.TimeOfDay.ToString();
     return(View());
 }
Ejemplo n.º 3
0
 public HomeController
 (
     // ISingletonDateService singletonDateService
     // IScopedDateService scopedDateService
     ITransientDateService transientDateService
 )
 {
     //_singletonDateService = singletonDateService;
     // _scopedDateService = scopedDateService;
     _transientDateService = transientDateService;
 }
Ejemplo n.º 4
0
 public IActionResult Index([FromServices] ITransientDateService transientDateService)
 {
     return(View(new List <DateTimeViewModel>()
     {
         new DateTimeViewModel {
             DateTimeNow = _singletonDateService.DateTimeNow
         },
         new DateTimeViewModel {
             DateTimeNow = _scopedDateService.DateTimeNow
         },
         new DateTimeViewModel {
             DateTimeNow = _transientDateService.DateTimeNow
         },
         new DateTimeViewModel {
             DateTimeNow = transientDateService.DateTimeNow
         }
     }));
 }
Ejemplo n.º 5
0
 public HomeController(ITransientDateService transientDateService)
 {
     _transientDateService = transientDateService;
 }
Ejemplo n.º 6
0
 public HomeController(ISingletonDateService singletonDateService, IScopedDateService scopedDateService, ITransientDateService transientDateService)
 {
     _singletonDateService = singletonDateService;
     _scopedDateService    = scopedDateService;
     _transientDateService = transientDateService;
 }