using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Domain;
using Service;

namespace WebSite.Controllers
{
    public class SysAuthorityController : BaseController
    {
		public ISysAuthorityManager SysAuthorityManager { get; set; }

		#region Action

		public ActionResult Index()
        {
			return View();
        }
		
		public ActionResult LoadAll()
		{
			var list = SysAuthorityManager.LoadAll().Where(r => r.ParentID != 0 && r.IsMenu && r.ActiveIndicator && r.IsLog).OrderBy(r => r.ID);

            var result = list.Select(r => new { r.ID, Name = ReturnNameByLanguage(r.Name, r.EName, r.TWName) }).ToList();

            result.Insert(0, new { ID = 0, Name = HttpContext.InnerLanguage("All") });

			return Json(result);
		}

		#endregion
	}
}
