Esempio n. 1
0
    /// <summary>
    /// 生成权限操作选项
    /// </summary>
    public static MvcHtmlString CreateOperations(this HtmlHelper helper)
    {
        string opLabel = "<label class=\"checkbox inline ml10\"><input type=\"checkbox\" id=\"op{0}\" name=\"op{0}\" />{1}</label>";
        OperationService service = new OperationService();
        IDictionary<int, string> operations = service.GetOperations();
        StringBuilder opBuilder = new StringBuilder();
        foreach (KeyValuePair<int, string> item in operations)
        {
            opBuilder.AppendFormat(opLabel, item.Key, item.Value);
        }

        return MvcHtmlString.Create(opBuilder.ToString());
    }
Esempio n. 2
0
    /// <summary>
    /// 生成权限操作选项
    /// </summary>
    public static MvcHtmlString CreateOperations(this HtmlHelper helper)
    {
        string                    opLabel    = "<label class=\"checkbox inline ml10\"><input type=\"checkbox\" id=\"op{0}\" name=\"op{0}\" />{1}</label>";
        OperationService          service    = new OperationService();
        IDictionary <int, string> operations = service.GetOperations();
        StringBuilder             opBuilder  = new StringBuilder();

        foreach (KeyValuePair <int, string> item in operations)
        {
            opBuilder.AppendFormat(opLabel, item.Key, item.Value);
        }

        return(MvcHtmlString.Create(opBuilder.ToString()));
    }
Esempio n. 3
0
        public async Task <ActionResult <IEnumerable <OperationDTO> > > GetOperations()
        {
            IEnumerable <Operation> operations = (await _service.GetOperations());

            return(operations.Select(m => m.ToDTO()).ToList());
        }