Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        public IEnumerable <DeliOrderModel> GetDeliOrderModels(int id)
        {
            var                   output = new DeliOrderModel();
            OrdersDAL             dal    = new OrdersDAL();
            List <DeliOrderModel> orders = dal.GetAllDeliOrders();

            for (int i = 0; i < orders.Count; i++)
            {
                if (orders[i].Id == id)
                {
                    output = orders[i];
                }
            }
            List <DeliOrderModel> outputt = new List <DeliOrderModel>();

            outputt.Add(output);
            return(outputt);
        }