Example #1
0
 public IEnumerable <Mortgage> ShortData(Shorting data, IEnumerable <Mortgage> _Mortgage)
 {
     return(_Mortgage.ToList().AsEnumerable());
     //string option = string.Empty;
     //if (!string.IsNullOrEmpty(data.shortBy) && !string.IsNullOrEmpty(data.thenBy) && data.shortBy.Equals(data.thenBy))
     //    data.orderThenBy = "0";
     //if (!string.IsNullOrEmpty(data.shortBy) && !string.IsNullOrEmpty(data.ordershortBy))
     //{
     //    if (!data.shortBy.Equals("0") && !data.ordershortBy.Equals("0"))
     //    {
     //        option = data.shortBy + data.shortBy;
     //    }
     //}
     //if (!string.IsNullOrEmpty(data.thenBy) && !string.IsNullOrEmpty(data.orderThenBy))
     //{
     //    if (!data.thenBy.Equals("0") && !data.orderThenBy.Equals("0"))
     //    {
     //        option = data.thenBy + data.orderThenBy;
     //    }
     //}
     //switch (option)
     //{
     //    case "11":
     //        return _Mortgage.OrderBy(x => x.MortgageType);
     //    case "12":
     //        return _Mortgage.OrderByDescending(x => x.MortgageType);
     //    case "21":
     //        return _Mortgage.OrderBy(x => x.InterestRate);
     //    case "22":
     //        return _Mortgage.OrderByDescending(x => x.InterestRate);
     //    case "1121":
     //        return _Mortgage.OrderBy(x => x.MortgageType).ThenBy(x => x.InterestRate);
     //    case "1122":
     //        return _Mortgage.OrderBy(x => x.MortgageType).ThenByDescending(x => x.InterestRate);
     //    case "1221":
     //        return _Mortgage.OrderByDescending(x => x.MortgageType).ThenBy(x => x.InterestRate);
     //    case "1222":
     //        return _Mortgage.OrderByDescending(x => x.MortgageType).ThenByDescending(x => x.InterestRate);
     //    default:
     //        return _Mortgage.OrderBy(x => x.MortgageType);
     //}
 }
Example #2
0
        public IEnumerable <Mortgage> getMortage(Shorting data = null)
        {
            List <Mortgage> _Mortgage = new List <Mortgage>();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(this.baseUrl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                var response = client.GetAsync(this.Url).Result;
                if (!response.IsSuccessStatusCode)
                {
                    return(null);
                }
                var    responseContent = response.Content;
                string responseString  = responseContent.ReadAsStringAsync().Result;
                _Mortgage = JsonConvert.DeserializeObject <List <Mortgage> >(responseContent.ReadAsStringAsync().Result);
                return(data == null?_Mortgage.AsEnumerable() : ShortData(data, _Mortgage.AsEnumerable()));
            }
        }