Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
        public IActionResult Post([FromBody] Location location)
        {
            var result = _locationRepo.Save(location);

            return(Ok(result));
        }
Ejemplo n.º 3
0
 public bool Save(Location obj)
 {
     return(locationRepo.Save(obj));
 }