Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/QueryController.cs

Last change on this file was 13862, checked in by jlodewyc, 8 years ago

#2582 Start angular OKB manager, data loaded

File size: 2.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Clients.Hive.WebJobManager.Services;
23using HeuristicLab.Clients.Hive.WebJobManager.Services.Imports;
24using HeuristicLab.Clients.Hive.WebJobManager.ViewModels;
25using Microsoft.AspNetCore.Http;
26using Microsoft.AspNetCore.Mvc;
27using System;
28
29namespace HeuristicLab.Clients.Hive.WebJobManager.Controllers
30{
31    public class QueryController : Controller
32    {
33        private WebLoginService weblog;
34        private Guid userId;
35        private QueryWebClient queryclient;
36        private bool init()
37        {
38            var u = HttpContext.Session.GetString("UserId");
39            weblog = WebLoginService.Instance;
40            if (u == null || u == "" || Guid.Parse(u) == Guid.Empty)
41            {
42                return false;
43            }
44            else
45            {
46                userId = Guid.Parse(u);
47
48                queryclient = weblog.getQueryClient(userId);
49                if (queryclient != null)
50                    return queryclient.CheckLogin();
51            }
52            return false;
53        }
54
55        public IActionResult Index()
56        {
57
58            if (init())
59            {
60                ViewBag.SessionId = HttpContext.Session.GetString("UserId");
61                ViewBag.Title = "OKB Query";
62                var q = new QueryVM(weblog.getCurrentUser(userId));
63                return View("Index", q );
64            }
65            else
66            {
67                return RedirectToAction("Index", "Home");
68            }
69        }
70    }
71}
Note: See TracBrowser for help on using the repository browser.