public virtual int Patch(Country country) { var countryToUpdate = _countriesRepository.Get(new object[] { country.Id }); if (!string.IsNullOrEmpty(country.IsoCode)) { countryToUpdate.IsoCode = country.IsoCode; } if (!string.IsNullOrEmpty(country.Name)) { countryToUpdate.Name = country.Name; } _countriesRepository.Update(countryToUpdate); return(_countriesRepository.Complete()); }
public async Task <IActionResult> GetGymsInCountry([FromQuery] int id) { try { var country = await _countryRepository.Get(id); if (country == null) { return(BadRequest("Country not found")); } var gyms = await _gymsService.GetCountryGyms(id); return(Ok(gyms)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public Countries Get(Int64 ixCountry) => _countriesRepository.Get(ixCountry);