Esempio n. 1
0
        //Method to pass information into the database and update the necessary game
        public ActionResult UpdateGame(GamePO 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
                    GameDO dataObject = MapGameTF.GamePOtoDO(form);
                    //calling on a DAL access field to allow us to use a specific method within, while passing in the DO object
                    _dataAccess.GameUpdate(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", "Game");
            }
            //section of code that runs if the form is not valid
            else
            {
                //assigning a value to our variable that will be used if the form isn't valid
                result = View(form);
            }
            //runs the portion of code that is necessary for the situation
            return(result);
        }