mycorerepository/MyCore/Controllers/LayoutController.cs
2020-03-06 17:09:57 +01:00

65 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MQTTnet;
using MQTTnet.Client;
using MQTTnet.Server;
using MyCore.Models;
using MyCore.Models.Layout;
using MyCore.Services;
using static MyCore.Services.OddService;
namespace MyCore.Controllers
{
[Authorize(Roles = "User")]
[Route("api/layout")]
[ApiController]
public class LayoutController : ControllerBase
{
// GET api/values
/// <summary>
/// It's a test ! :)
/// </summary>
[AllowAnonymous]
[HttpGet("panelSection")]
public ActionResult<IEnumerable<PanelSection>> Get()
{
List<PanelSection> panelSectionToSend = new List<PanelSection>();
PanelSection panelSection = new PanelSection();
panelSection.Label = "System";
panelSection.Icon = "System";
panelSection.Color = "System";
panelSection.DefaultRoute = "System";
List<PanelMenuItem> panelMenuItemList = new List<PanelMenuItem>();
PanelMenuItem panelMenuItem1 = new PanelMenuItem();
panelMenuItem1.Label = "About";
panelMenuItem1.Route = "/system/summary";
panelMenuItem1.Icon = "fa-question-circle";
panelMenuItem1.BadgeValue = 0;
panelMenuItem1.BadgeType = null;
panelMenuItem1.Children = null;
PanelMenuItem panelMenuItem2 = new PanelMenuItem();
panelMenuItem2.Label = "Events";
panelMenuItem2.Route = "/system/events";
panelMenuItem2.Icon = "fa-file-text";
panelMenuItem2.BadgeValue = 0;
panelMenuItem2.BadgeType = null;
panelMenuItem2.Children = null;
panelMenuItemList.Add(panelMenuItem1);
panelMenuItemList.Add(panelMenuItem2);
panelSection.Children = panelMenuItemList;
panelSectionToSend.Add(panelSection);
return panelSectionToSend;
}
}
}