コード例 #1
0
ファイル: StatesManager.cs プロジェクト: alexgrbach/Projects
        public StateResponse GetStateResponse(string stateKey)
        {
            var response = new StateResponse();
            var states = GetStateDictionary();
            States state;

            if (states.TryGetValue(stateKey.ToUpper(), out state))
            {
                response.Success = true;
                response.State = state;
            }
            else
            {
                response.Success = false;
                response.Message = "State does not exist in dictionary";
            }
            return response;
        }
コード例 #2
0
ファイル: StateManager.cs プロジェクト: alexgrbach/Projects
        public StateResponse GetStateResponse(string stateAbbreviation)
        {
            var response = new StateResponse();
            var states = GetAllStates();

            foreach (var state in states)
            {
                if (state.StateAbbreviation != stateAbbreviation) continue;

                response.Success = true;
                response.State = state;
                return response;
            }

            response.Success = false;
            response.Message = "You did something wrong again...";
            return response;
        }