//Method for adding a new player to the database
        public void PlayerCreate(PlayerDO player)
        {
            //Defining SqlConnection for this method
            SqlConnection scon = new SqlConnection(_conn);

            //Beginning the processes
            try
            {
                //Defining a variable for the SqlCommand, as well as the stored proc and connection we're using
                SqlCommand createPlayer = new SqlCommand("PLAYER_ADD", scon);
                //Defining what kind of command our SqlCommand is
                createPlayer.CommandType = CommandType.StoredProcedure;
                //opening sql connection
                scon.Open();
                //Adding in all the variables. Format: ("@SqlVariable", C#VariableValue)
                createPlayer.Parameters.AddWithValue("@Name", player.Name);
                createPlayer.Parameters.AddWithValue("@PeakRating", player.PeakRating);
                createPlayer.Parameters.AddWithValue("@BirthDate", player.BirthDate);
                createPlayer.Parameters.AddWithValue("@Dead", player.Dead);
                createPlayer.Parameters.AddWithValue("@CountryOfOrigin", player.CountryOfOrigin);
                createPlayer.Parameters.AddWithValue("@CountryRepresented", player.CountryRepresented);
                //telling the code to use the stored procedure
                createPlayer.ExecuteNonQuery();
            }
            //Catch for any errors that may happen
            catch (Exception ex)
            {
                //passing in the exception that was thrown to the errorhandler
                ErrorHandlerDAL.ErrorLogger(ex);
            }
            //finally cleans up any last loose ends
            finally
            {
                //closing SqlConnection
                scon.Close();
                //disposing of the SqlConnection
                scon.Dispose();
            }
        }
        //Method to pass in all information gathered from a user and update a player's information in the database
        public ActionResult UpdatePlayer(PlayerPO form)
        {
            //Declaring an action result variable, but assigning it to null to reassign later
            ActionResult result = null;

            //Checks to see if the UI form is filled out correctly
            if (ModelState.IsValid)
            {
                //Beginning of processes
                try
                {
                    //passing the UI form information to run through our mapper, and assigning it to a DO object
                    PlayerDO dataObject = MapPlayerTF.PlayerPOtoDO(form);
                    //calling on a DAL access field to allow us to use a specific method within, while passing in the DO object
                    _dataAccess.PlayerUpdate(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
                { }
                //assigns a page redirection to our variable
                result = RedirectToAction("Index", "Player");
            }
            //section of code that runs if the form is not valid
            else
            {
                //assigns a page redirection to our variable
                result = View(form);
            }
            //runs the portion of code that is necessary for the situation
            return(result);
        }
 public void init()
 {
     _playerDO = new PlayerDO();
 }