示例#1
0
        /// <summary>
        /// Read all informaton in the database about orders
        /// </summary>
        /// <returns></returns>
        public ActionResult ViewOrders()
        {
            ActionResult response;

            if ((string)Session["RoleName"] == "Admin")
            {
                List <OrderDO> allOrders    = ordersDAO.ViewOrders();
                List <Order>   OrdersMapped = new List <Order>();
                foreach (OrderDO orderObject in allOrders)
                {
                    OrdersMapped.Add(orderMapper.MapDoToPO(orderObject));
                }

                response = View(OrdersMapped);
            }
            else
            {
                response = RedirectToAction("Index", "Home");
            }
            return(response);
        }