public RestaurantListEntity ToRestaurantListEntity() { RestaurantListEntity entity = new RestaurantListEntity { restId = this.Id.ToString(), Name = this.Name }; string strCity = (this.Adress.City == null ? "Unknown" : this.Adress.City); entity.DisplayName = string.Format("{0}|{1}|{2}", this.Name, strCity, this.Description); return entity; }
public List<RestaurantListEntity> ToStringRestaurantsList(List<RestaurantBasicData> restaurantsBasicList) { log.InfoFormat("[ToStringRestaurantsList] restaurantsBasicListCount={0}", restaurantsBasicList.Count.ToString()); List<RestaurantListEntity> restList = new List<RestaurantListEntity>(); foreach (var rest in restaurantsBasicList) { RestaurantListEntity tempEntity = new RestaurantListEntity(); tempEntity.restId = rest.Id.ToString(); tempEntity.Name = rest.Name; string strCity = (rest.Adress.City == null ? "Unknown" : rest.Adress.City); tempEntity.DisplayName = string.Format("{0}|{1}|{2}", rest.Name, strCity, rest.Description); restList.Add(tempEntity); } return restList; }
public List<RestaurantListEntity> IdsListToRestaurantListEntity(List<string> list) { List<RestaurantListEntity> entitysList = new List<RestaurantListEntity>(); foreach (var id in list) { RestaurantListEntity tempEntity = new RestaurantListEntity(); RestaurantBasicData rest = GetRestaurantBasicById(id); tempEntity.restId = rest.Id.ToString(); tempEntity.Name = rest.Name; string strCity = (rest.Adress.City == null ? "Unknown" : rest.Adress.City); tempEntity.DisplayName = string.Format("{0}|{1}|{2}", rest.Name, strCity, rest.Description); entitysList.Add(tempEntity); } return entitysList; }