public async Task <bool> CheckIfExists(CityServiceModel city) { if (await dbContext.Cities.AnyAsync(c => c.Name == city.Name)) { return(true); } return(false); }
public async Task <bool> AddCity(CityServiceModel cityServiceModel) { City city = Mapper.Map <City>(cityServiceModel); ValidateCity(city); await dbContext.Cities.AddAsync(city); var result = await dbContext.SaveChangesAsync(); return(result > 0); }