Пример #1
0
        public ActionResult Orders(int permissionLevel = 0)
        {
            AllOrdersModel orders = new AllOrdersModel();
            OrdersDAL      dal    = new OrdersDAL();

            orders.User = Session["User"] as UserInfoModel;

            //admin
            if (permissionLevel == 1 || orders.User.IsAdmin)
            {
                orders.DeliOrders   = dal.GetAllDeliOrders();
                orders.BakeryOrders = dal.GetAllBakeryOrders();
            }
            //bakery
            else if (permissionLevel == 2 || orders.User.IsBakery)
            {
                orders.BakeryOrders = dal.GetAllBakeryOrders();
            }
            //deli
            else if (permissionLevel == 3 || orders.User.IsDeli)
            {
                orders.DeliOrders = dal.GetAllDeliOrders();
            }
            return(View("Orders", orders));
        }