public ActionResult AddGame(Game form) { ActionResult response; // checks role if (Session["RoleId"] != null && (long)Session["RoleId"] == 5) { try { //check modelstate if (ModelState.IsValid) { //maps dataObject new game DO GameDO dataObject = new GameDO(); dataObject.GameId = form.GameId; dataObject.Title = form.Title; dataObject.Description = form.Description; dataObject.DevelopingCompany = form.DevelopingCompany; dataObject.GameCondition = form.Condition; dataObject.Price = form.Price; //Adds a game based off the dao _GameDataAccess.AddGame(dataObject); //Temporarily holds onto the title TempData["Title"] = dataObject.Title; response = RedirectToAction("AddGame", "Game"); } else { // sets the response to View the form response = View(form); } } //catches and exception and logs it catch (SqlException sqlex) { _Logger.ErrorLog(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, sqlex); response = RedirectToAction("AllUsers", "Account"); } catch (Exception ex) { _Logger.ErrorLog(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ex); response = RedirectToAction("AllUsers", "Account"); } } else//if the check fails sets the response { response = RedirectToAction("Login", "Account"); } return(response); }