public void TestLocationRepo_CheckRepo() { var locationRepo = new LocationRepo(TripLineConfig.LocationRepoPath + "2", forceNew: true); Assert.IsTrue(locationRepo.Content.Locations.Count == 0); locationRepo.Add(new Location() { City = "Montreal" }); locationRepo.Save(); Assert.IsTrue(locationRepo.Content.Locations.Count == 1); locationRepo.ClearContent(); Assert.IsTrue(locationRepo.Content.Locations.Count == 0); // reload to see iuf they are really saved locationRepo.Reload(); // Check Assert.IsTrue(locationRepo.Content.Locations.Count == 1); Assert.IsTrue(locationRepo.Content.Locations[0].City == "Montreal"); }
public IActionResult Post([FromBody] Location location) { var result = _locationRepo.Save(location); return(Ok(result)); }
public bool Save(Location obj) { return(locationRepo.Save(obj)); }