Exemple #1
0
        //[ValidateAntiForgeryToken]
        ///<summary>
        /// Attempts to deactivate team
        /// </summary>
        public ActionResult DeactivateTeam(int teamID)
        {
            ActionResult oResponse = null;
            var          userPO    = (IUserPO)Session["UserModel"];

            if (userPO.Email != null && userPO.RoleID_FK == (int)RoleEnum.Administrator)
            {
                try
                {
                    _TeamDataAccess.DeactivateTeam(teamID);
                }
                catch (Exception ex)
                {
                    var error = new TeamViewModel();
                    ErrorLogger.LogError(ex, "DeactivateTeam", "Maint");
                    error.ErrorMessage = "There was an issue with archiving the selected team. Please try again. If the problem persists contact your IT team.";
                }
                finally
                {
                    // TODO: Always return to view all - not set in stone can be discussed
                    oResponse = RedirectToAction("ViewAllTeams", "Maint");
                }
            }
            else
            {
                oResponse = RedirectToAction("Index", "Home");
            }

            return(oResponse);
        }
        public static void TestFixtureTearDown()
        {
            //cleanup
            string clearSql = "truncate table [User]";

            using (SqlConnection connection = new SqlConnection(_UserDataAccess.ConnectionParms))
            {
                using (SqlCommand command = new SqlCommand(clearSql, connection))
                {
                    connection.Open();
                    command.ExecuteNonQuery();
                }
            }
            _TeamDataAccess.DeactivateTeam(TESTCREATETEAMDATA.TeamID);
        }