Beispiel #1
0
        public async Task <int> AddFiles <T>(IEnumerable <T> files) where T : File
        {
            foreach (var file in files)
            {
                _dbContext.Images.Add(file as Image);
            }

            return(await _dbContext.SaveChangesAsync());
        }
Beispiel #2
0
        public async Task <int> SaveAreasAsync(IEnumerable <Area> areas)
        {
            foreach (var area in areas)
            {
                _dbContext.Areas.Add(area);
            }

            return(await _dbContext.SaveChangesAsync());
        }
        public async Task <int> SaveAreaGeoPoints(IEnumerable <GeoPoint> geoPoints)
        {
            foreach (var geoPoint in geoPoints)
            {
                _dbContext.GeoPoints.Add(geoPoint);
            }

            return(await _dbContext.SaveChangesAsync());
        }
        public async Task <int> SaveMap(Map map)
        {
            var user = _dbContext.Users.FirstOrDefault(x => x.Id == map.UserId);

            if (user == null)
            {
                throw new ArgumentException("The user id is not valid");
            }

            _dbContext.Maps.Add(map);
            return(await _dbContext.SaveChangesAsync());
        }