public void updateCity([FromBody] CityDto citytdo) { City city = _mapper.Map <City>(citytdo); _city.Update(city); }
public async Task <IActionResult> Save(CityDto city) { var newcity = await _cityService.AddAsync(_mapper.Map <City>(city)); return(Created(string.Empty, _mapper.Map <CityDto>(newcity))); }
public CityDto GetByName(string name) { CityDto city = _cityList.FirstOrDefault(x => x.Name == name); return(city); }
//[Route("[action]")] public IActionResult GetCityDataTest(int id, bool includeRelations = false) { if (_cityControllerParameters_Object._use_Lazy_Loading_On_City_Controller) { if (false == includeRelations) { _repositoryWrapper.CityInfoRepositoryWrapper.DisableLazyLoading(); var cityEntity = _repositoryWrapper.CityInfoRepositoryWrapper.FindOne(id); if (null == cityEntity) { return(NotFound()); } else { if (_cityControllerParameters_Object._show_Empty_Related_Date_Fields) { CityDto CityDto_Object = _mapper.Map <CityDto>(cityEntity); return(Ok(CityDto_Object)); } else { CityDtoMinusRelations CityDto_Object = _mapper.Map <CityDtoMinusRelations>(cityEntity); return(Ok(CityDto_Object)); } } } else // true == includeRelations { _repositoryWrapper.CityInfoRepositoryWrapper.EnableLazyLoading(); var cityEntity = _repositoryWrapper.CityInfoRepositoryWrapper.FindOne(id); if (null == cityEntity) { return(NotFound()); } else { CityDto CityDto_Object = _mapper.Map <CityDto>(cityEntity); if (_cityControllerParameters_Object._show_Cyclic_Data) { return(Ok(cityEntity)); } else { return(Ok(CityDto_Object)); } } } } else // !_use_Lazy_Loading_On_City_Controller { _repositoryWrapper.CityInfoRepositoryWrapper.DisableLazyLoading(); if (false == includeRelations) { var cityEntity = _repositoryWrapper.CityInfoRepositoryWrapper.GetCity(id, includeRelations); if (null == cityEntity) { return(NotFound()); } else { if (_cityControllerParameters_Object._show_Empty_Related_Date_Fields) { var CityDto_Object = _mapper.Map <CityDto>(cityEntity); return(Ok(CityDto_Object)); } else { var CityDto_Object = _mapper.Map <CityDtoMinusRelations>(cityEntity); return(Ok(CityDto_Object)); } } } else // true == includeRelations { var cityEntity = _repositoryWrapper.CityInfoRepositoryWrapper.GetCity(id, includeRelations); if (null == cityEntity) { return(NotFound()); } else { CityDto CityDto_Object = _mapper.Map <CityDto>(cityEntity); if (_cityControllerParameters_Object._show_Cyclic_Data) { return(Ok(cityEntity)); } else { return(Ok(CityDto_Object)); } } } } }
public Task <CityDto> UpdateAsync(int id, CityDto input) { throw new System.NotImplementedException(); }
public CityDto Add(CityDto subject) { return(cityStorage.Add(subject)); }
public Task <DinazorResult> Update(CityDto t) { throw new System.NotImplementedException(); }
public void AttachPointOfInterestToCity(CityDto city, PointOfInterestDto pointOfInterest) { city.PointsOfInterest.Add(pointOfInterest); }
public void CityDto_Property_Count() { var city = new CityDto(); Assert.AreEqual(6, city.GetType().GetProperties().Count()); }
public async Task <DinazorResult> Save(CityDto t) { return(await _cityOperation.Save(t)); }
// POST: api/Cities public CityDto Post(CityDto city) { CityRepository.Instance.Add(city); return(city); }
public IActionResult GetCurrentWeather(CityDto city) { City findCity = _db.Cities.Where(c => c.Key == city.Key).FirstOrDefault(); if (findCity == null) { findCity = new City() { CityName = city.Name, Key = city.Key, Country = city.Country }; _db.Cities.Add(findCity); _db.SaveChanges(); } Weather findWeather = _db.Weathers.Where(w => w.Key == city.Key).FirstOrDefault(); if (findWeather != null && findWeather.LastUpdate.AddDays(1) > DateTime.Now) { Favorite fav = _db.Favorites.Where(f => f.CityId == findCity.CityId).FirstOrDefault(); WeatherDto weatherObj = new WeatherDto() { CityName = city.Name, Country = city.Country, Key = city.Key, Temperature = findWeather.Temperature, WeatherText = findWeather.WeatherText, IsFavorite = fav != null }; return(Ok(weatherObj)); } try { WeatherAPIDto weatherAPIObj = getWeatherFromAPI(city.Key); if (findWeather != null) { findWeather.Temperature = weatherAPIObj.Temperature.Metric.Value; findWeather.WeatherText = weatherAPIObj.WeatherText; _db.Update(findWeather); } else { findWeather = new Weather() { CityId = findCity.CityId, Key = findCity.Key, Temperature = weatherAPIObj.Temperature.Metric.Value, WeatherText = weatherAPIObj.WeatherText, LastUpdate = DateTime.Now }; _db.Add(findWeather); } _db.SaveChanges(); Favorite fav = _db.Favorites.Where(f => f.CityId == findCity.CityId).FirstOrDefault(); WeatherDto weatherObj = new WeatherDto() { CityName = city.Name, Country = city.Country, Key = city.Key, Temperature = findWeather.Temperature, WeatherText = findWeather.WeatherText, IsFavorite = fav != null }; return(Ok(weatherObj)); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(StatusCode(500, ModelState)); }
public CityDto CreateCity(CityDto dto) { return(new CountryLogic().CreateCity(dto)); }
public static void MapToDto(this CityDto cityDto, CityViewModel cityViewModel) { cityDto.Id = cityViewModel.Id == null ? int.MinValue : cityViewModel.Id.Value; cityDto.Name = cityViewModel.Name; }
public IActionResult Update([FromBody] CityDto obj, [FromHeader] string Authorization) { CityDto newObj = _repo.Update(obj); return(Ok(newObj)); }
public PointOfInterestDto GetOnePointOfInterest(CityDto city, int pointOfInterestId) { var entity = city.PointsOfInterest.SingleOrDefault(e => e.Id == pointOfInterestId); return(entity); }
public async Task <ActionResponse <CityDto> > UpdateCity([FromBody] CityDto entityDto) { return(await locationService.UpdateCity(entityDto)); }
public Task <CityDto> CreateAsync(CityDto input) { throw new System.NotImplementedException(); }
public void CreateCity(CityDto cityDto) { throw new System.NotImplementedException(); }
public void SaveCity([FromBody] CityDto dto) { cityService.saveCity(dto); }
public void UpdateCityInfo(CityDto city) { SelectedCity = city; Organizations = new ObservableCollection <OrganizationDto>(SelectedCity.Organizations); Contacts = null; }
public void Update(CityDto subject) { cityStorage.Update(subject); }
public static int newDtoCity(CityDto CityDto) { return(CityManager.NewCity(CityDto)); }
private async Task CreateAsync(CityDto input) { var city = ObjectMapper.Map <City>(input); await _cityRepository.InsertAsync(city); }
public static void editDtoCity(CityDto CityDto) { CityManager.editCity(CityDto); }
public void Post([FromBody] CityDto city) { City result = _mapper.Map <City>(city); _city.Create(result); }
public async Task <GetFilterListResponse> GetFilterList() { try { var countries = await _listingRepository.GetAllCounties(); var provinces = await _listingRepository.GetAllProvinces(); var listingtypes = await _listingRepository.GetAllListings(); var cities = await _listingRepository.GetAllCities(); GetFilterListResponse filterListResponse = new GetFilterListResponse(); filterListResponse.CountryList = new List <CountryDto>(); filterListResponse.ListingTypes = new List <ListingDto>(); foreach (var listingType in listingtypes) { ListingDto listingDto = new ListingDto() { ListingFilterName = listingType.ListingName, ListingType = listingType.Id }; filterListResponse.ListingTypes.Add(listingDto); } foreach (var country in countries) { var countryDto = new CountryDto(); countryDto.CountryType = country.Id; countryDto.CountryName = country.CountryName; countryDto.Provinces = new List <ProvinceDto>(); foreach (var province in provinces) { if (province.CountryRefId == country.Id) { var provinceDto = new ProvinceDto(); provinceDto.Cities = new List <CityDto>(); provinceDto.ProvinceType = province.Id; provinceDto.ProvinceName = province.ProvinceName; foreach (var city in cities) { if (city.CountryRefId == country.Id && city.ProvinceRefId == province.Id) { var cityDto = new CityDto() { CityName = city.RegionName, CityType = city.Id }; provinceDto.Cities.Add(cityDto); } } countryDto.Provinces.Add(provinceDto); } } filterListResponse.CountryList.Add(countryDto); } return(filterListResponse); } catch (Exception ex) { _logger.LogError($"error while constructing filter list: {ex}"); throw ex.GetBaseException(); } }
public void UpdateCity(CityDto input) { var instanse = Mapper.Map<City>(input); this.unitOfWork.Entities<City, int>().Update(instanse); }
public List <PointOfInterestDto> GetAllPointsOfInterest(CityDto city) { return(city.PointsOfInterest.ToList()); }
public IActionResult Update(CityDto city) { var updatecity = _cityService.Update(_mapper.Map <City>(city)); return(Ok(_mapper.Map <CityDto>(updatecity))); }
public CityCreateModel(CityDto city) { Name = city.Name; Description = city.Description; }