You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

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", 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 });
}
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;
}
}
}