Changeset 13739 for branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/ResourceController.cs
- Timestamp:
- 03/29/16 17:02:16 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/ResourceController.cs
r13733 r13739 1 1 using HeuristicLab.Clients.Hive.WebJobManager.Services; 2 2 using Microsoft.AspNet.Hosting; 3 using Microsoft.AspNet.Http; 3 4 using Microsoft.AspNet.Mvc; 4 5 using System; … … 12 13 public class ResourceController : Controller 13 14 { 14 private HiveServiceClient client; 15 private WebLoginService weblog; 16 private HiveServiceLocatorWeb serviceLocator; 17 private HiveServiceClient serviceClient; 18 private HiveClientWeb clientWeb; 19 private Guid userId; 20 15 21 private IHostingEnvironment _environment; 16 22 17 23 public ResourceController(IHostingEnvironment env) 18 24 { 19 HiveServiceLocatorWeb hiveServiceLocator = (HiveServiceLocatorWeb)HiveServiceLocatorWeb.Instance; 20 client = hiveServiceLocator.getHiveServiceClient(); 25 weblog = WebLoginService.Instance; 26 var u = HttpContext.Session.GetString("UserId"); 27 if (u == null || u == "" || Guid.Parse(u) == Guid.Empty) 28 { 29 userId = Guid.Empty; 30 serviceLocator = new HiveServiceLocatorWeb(); 31 serviceClient = serviceLocator.getHiveServiceClient(); 32 clientWeb = new HiveClientWeb(serviceLocator, userId); 33 } 34 else { 35 userId = Guid.Parse(u); 36 37 serviceLocator = weblog.getServiceLocator(userId); 38 serviceClient = serviceLocator.getHiveServiceClient(); 39 clientWeb = weblog.getClientWeb(userId); 40 } 21 41 22 42 _environment = env; … … 24 44 public IActionResult Index() 25 45 { 26 if ( ((HiveServiceLocatorWeb)(HiveServiceLocatorWeb.Instance)).CheckLogin())46 if (serviceLocator.CheckLogin()) 27 47 { 28 48 … … 32 52 else 33 53 { 34 HiveServiceLocatorWeb.SetLoginErrorMessage();35 54 return RedirectToAction("Index", "Home"); 36 55 }
Note: See TracChangeset
for help on using the changeset viewer.