private void SetArea(City city) { IList <KeyValuePair <StrativeView, double> > values = new List <KeyValuePair <StrativeView, double> >(); var areas = StrativeView.ToArea(city); foreach (var item in areas) { values.Add(new KeyValuePair <StrativeView, double>(item, item.score)); } _cacheStorage.SortedSetAdd(_cacheModel, city.Code, values); }
public IList <StrativeView> GetAreas(string cityCode) { var data = _cacheStorage.SortedSetRangeByRank <string, StrativeView> (AdministrativeAreaStaticResource.DBINDEX, cityCode); if (data == null || data.Count == 0) { var entity = _provinceRepository.GetCityArea(cityCode); data = StrativeView.ToArea(entity); } return(data); }