Exemple #1
0
        public async Task <bool> CheckIfExists(CityServiceModel city)
        {
            if (await dbContext.Cities.AnyAsync(c => c.Name == city.Name))
            {
                return(true);
            }

            return(false);
        }
Exemple #2
0
        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);
        }