public ActionResult Index()
        {
            List <OrderPO> mappedItems = new List <OrderPO>();

            try
            {
                List <OrdersDO> dataObjects = dataAccess.ViewAllOrders();
                mappedItems = OrderMapper.MapDoToPo(dataObjects);
            }
            catch (Exception ex)
            {
                if (ex.Data.Contains("Message"))
                {
                    TempData["Message"] = "No Orders";
                }
            }

            return(View(mappedItems));
        }
示例#2
0
        public ActionResult ViewAllOrders()
        {
            ActionResult response;

            try
            {
                //mapping all the data to the view page
                List <OrdersDO> _Orders = _OrdersDAO.ViewAllOrders();
                List <OrdersPO> Orders  = Mapper.OrdersListDOtoPO(_Orders);
                response = View(Orders);
            }
            //logging errors and redirecting
            catch (SqlException sqlEx)
            {
                Logger.SqlErrorLog(sqlEx);
                response = View("Error");
            }
            catch (Exception ex)
            {
                Logger.ErrorLog(ex);
                response = View("Error");
            }
            return(response);
        }