Exemplo n.º 1
0
        public CityDomainModel Add(AirdnaModel cityRequest)
        {
            var city = Get(cityRequest);

            if (city is null)
            {
                var newKey = 1;
                foreach (var cityTemp in _cities)
                {
                    if (cityTemp.Id > newKey)
                    {
                        newKey = cityTemp.Id;
                    }
                }

                newKey++;

                city = new CityDomainModel()
                {
                    Id = newKey,
                    CityOriginalName = cityRequest.CityOriginalName,
                    Airdna           = (AirdnaModel)cityRequest.Clone(),
                };

                _cities.Add(city);

                _saveChanges();
            }

            return(city);
        }
Exemplo n.º 2
0
        public CityDomainModel Get(AirdnaModel cityRequest)
        {
            var city = Get().Where(x => x.Airdna.CityId == cityRequest.CityId).Select(x => x).FirstOrDefault();

            return(city);
        }