private void Seed(IDataContext context) { Console.WriteLine("Seeding..."); if (context == null) { throw new NullReferenceException(nameof(IDataContext)); } if (!context.PointsOfInterest.Any()) { foreach (var item in Enumerable.Range(1, 10000)) { var point = new PointOfInterest { DateAdded = DateTime.UtcNow, Latitude = 0, Longitude = 0 }; var query = new AddPointOfInterest(context); query.Execute(point); Console.WriteLine("Adding POI"); } context.SaveChanges(); } }
public async Task Post([FromBody] PointOfInterestPostModel model) { var poi = new PointOfInterest { Latitude = model.Latitude, Longitude = model.Longitude, DateAdded = DateTime.UtcNow, }; var command = new AddPointOfInterest(this.context); await command.Execute(poi); }