summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Seed.cs
blob: 13bd4aa65987a5a247994b44589d190e85c89cc9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using Bogus;
using Bogus.Locations;
using WhatApi.Tables;

namespace WhatApi;

public partial class Program
{
    private static void Seed(Database db) {
        if (db.Places.Any() || true) return;
        var places = new List<Place>();
        var location = new Faker().Location();
        for (var i = 0; i < 1000; i++) {
            var point = location.AreaCircle(59.91838, 10.73861, 30000);
            places.Add(new Place() {
                Location = new Point(new Coordinate(point.Longitude, point.Latitude)),
                ContentId = new Guid("1337710a-8cdb-4d50-815f-772c0e9f1482")
            });
        }
        db.Places.AddRange(places);
        db.SaveChanges();
    }
}