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 MenuItems(string usertype) public static List MenuItems(string usertype) { Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper(); httpcli.CallService("MenuItem", usertype, "GET", null); if (httpcli.Results.resultstatus == true) { List mis = new List(); List menus = JsonConvert.DeserializeObject>(httpcli.Results.daten); //List mis = new List(); //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; } } }