Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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;
        }