コード例 #1
0
        //Method to search the database for a player by the name of the player
        public ActionResult ReadPlayerByName(string winner, int wins)
        {
            //declaring list using model GamePO
            List <PlayerPO> mappedPlayer = new List <PlayerPO>();

            //Beginning of processes
            try
            {
                //declaring list using Model PlayerDO in order to retrieve database information
                List <PlayerDO> player = _dataAccess.PlayerReadByName(winner);
                //loop to get all objects assigned appropriately
                foreach (PlayerDO dataObject in player)
                {
                    //assign our PO list all of the values that were in the DO list via mapper
                    mappedPlayer.Add(MapPlayerTF.PlayerDOtoPO(dataObject));
                }
            }
            //catch to record any exceptions that crop up
            catch (Exception ex)
            {
                //call to method to record necessary information
                ErrorFile.ErrorHandlerPL(ex);
            }
            //finally to tie up any loose ends
            finally
            { }
            //Sends the data in the list to the view to be seen by the user.
            return(View(mappedPlayer));
        }