Esempio n. 1
0
        public IActionResult SetMenu()
        {
            string id = Request.Querys("orgid");

            if (id.IsNullOrWhiteSpace())
            {
                id = Request.Querys("workgroupid");
                if (!id.IsNullOrWhiteSpace())
                {
                    id = Business.Organize.PREFIX_WORKGROUP + id;
                }
            }
            if (id.IsNullOrWhiteSpace())
            {
                id = Request.Querys("userid");
                if (!id.IsNullOrWhiteSpace())
                {
                    id = Business.Organize.PREFIX_USER + id;
                }
            }
            ViewData["tableHtml"]   = new Business.Menu().GetMenuTreeTableHtml(id);
            ViewData["prevUrl"]     = Request.Querys("prevurl").UrlDecode();
            ViewData["queryString"] = Request.UrlQuery();
            return(View());
        }
        public HttpResponseMessage GetMenuByCompany(int id)
        {
            var menu   = new Business.Menu();
            var result = menu.GetByCompany(id);

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
        public HttpResponseMessage GetMenuAuth(int id)
        {
            ApplicationUser user = HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(HttpContext.Current.User.Identity.GetUserId());

            if (user == null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, false));
            }

            var menu   = new Business.Menu();
            var result = menu.GetMenuAuthByCompany(user.CompanyId, id);

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
 public MenuController()
 {
     _menu = new Business.Menu();
 }