Update 20210528 - mit LoginPopup
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace sf1.Models
|
||||
namespace App.Models
|
||||
{
|
||||
public class ICRUDModel<T> where T : class
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace sf1.Models
|
||||
namespace App.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
|
||||
13
App/Models/LoginModel.cs
Normal file
13
App/Models/LoginModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace APP.Models
|
||||
{
|
||||
public class LoginModel
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
61
App/Models/MenuItem.cs
Normal file
61
App/Models/MenuItem.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using BWPMModels;
|
||||
|
||||
|
||||
namespace App.Models
|
||||
{
|
||||
public class AppMenuItem
|
||||
{
|
||||
|
||||
public string id { get; set; }
|
||||
public string text { get; set; }
|
||||
public string parentId { get; set; }
|
||||
public string url { get; set; }
|
||||
|
||||
//public static List<AppMenuItem> MenuItems(string usertype)
|
||||
public static List<object> MenuItems(string usertype)
|
||||
{
|
||||
|
||||
|
||||
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
|
||||
httpcli.CallService("MenuItem", APP.Models.SessionClass.UserType, "GET", null);
|
||||
if (httpcli.Results.resultstatus == true)
|
||||
{
|
||||
List<object> mis = new List<object>();
|
||||
List<BWPMModels.MenuItem> menus = JsonConvert.DeserializeObject<List<BWPMModels.MenuItem>>(httpcli.Results.daten);
|
||||
//List<AppMenuItem> mis = new List<AppMenuItem>();
|
||||
|
||||
//mis.Add (new AppMenuItem { id = "1", text = "Text 1", parentId = "", url = "Home" });
|
||||
//mis.Add(new AppMenuItem { id = "2", text = "Text 2", parentId = "1", url = "Form" });
|
||||
//mis.Add(new AppMenuItem { id = "3", text = "Text3", parentId = "null", url = "" });
|
||||
//return mis;
|
||||
|
||||
foreach (BWPMModels.MenuItem item in menus)
|
||||
{
|
||||
mis.Add(new AppMenuItem { id = item.ID, text = item.text, parentId = item.parentId, url = item.url });
|
||||
}
|
||||
if (APP.Models.SessionClass.UserName == "")
|
||||
{
|
||||
mis.Add(new AppMenuItem { id = "999", text = "Login" , parentId = "", url = "Login"});
|
||||
}
|
||||
|
||||
return mis;
|
||||
}
|
||||
|
||||
//ViewBag.DataSource = users;
|
||||
|
||||
//menus.Add(new MenuItem { id = "1", text = "Text 1", parentId = "", url="Home" });
|
||||
//menus.Add(new MenuItem { id = "2", text = "Text 2", parentId = "1", url="Form"});
|
||||
//menus.Add(new MenuItem { id = "3", text = "Text3", parentId = "null",url="" });
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
21
App/Models/SessionClass.cs
Normal file
21
App/Models/SessionClass.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace APP.Models
|
||||
{
|
||||
public static class SessionClass
|
||||
{
|
||||
public static string UserType { get; set; } = "0";
|
||||
public static string UserName { get; set; } = "";
|
||||
|
||||
public static void SetSessionValue()
|
||||
{
|
||||
UserType = "1";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user