Inheritance: MongoRepositoryBase
Exemplo n.º 1
0
 public void DeleteRestaurantOsm(string id)
 {
     log.DebugFormat("[DeleteRestaurantOsm] id={0}.", id);
     //using (ImportedRestaurants restaurantsDb = new ImportedRestaurants())
     using (FinlandSwedenOSMRestaurants restaurantsDb = new FinlandSwedenOSMRestaurants())
     {
         MongoEntityRepositoryBase<RestaurantOsm> basicData =
                       new MongoEntityRepositoryBase<RestaurantOsm>(restaurantsDb.DB);
         basicData.Delete(ObjectId.Parse(id));
     }
 }
Exemplo n.º 2
0
 public string AddRestToImportedDB(RestaurantOsm rest)
 {
     try
     {
         log.InfoFormat("[AddRestToImportedDB] rest.Name={0}, rest.Name={0}, rest.NodeReference.id={1}.", rest.Name, rest.NodeReference.id);
         rest.CreatedAt = DateTime.UtcNow;
         //using (ImportedRestaurants restaurantsDb = new ImportedRestaurants())
         using (FinlandSwedenOSMRestaurants restaurantsDb = new FinlandSwedenOSMRestaurants())
         {
             MongoEntityRepositoryBase<RestaurantOsm> basicData =
                             new MongoEntityRepositoryBase<RestaurantOsm>(restaurantsDb.DB);
             basicData.Add(rest);
             return rest.Id.ToString();
         }
     }
     catch (Exception e)
     {
         log.ErrorFormat("[AddRestToImportedDB] Exception={0}.", e);
         return null;
     }
 }
Exemplo n.º 3
0
 public string AddRestaurantsCompareListToImportedDB(RestaurantsCompareList compareList)
 {
     try
     {
         compareList.CompareDate = DateTime.UtcNow;
         log.InfoFormat("[AddRestaurantsCompareListToImportedDB] compareList.CompareDate={0}, compareList.CompareSource={1}, compareList.Count={2}, compareList.Id={3}.", compareList.CompareDate, compareList.CompareSource, compareList.CompareList.Count, compareList.Id.ToString());
         //using (ImportedRestaurants restaurantsDb = new ImportedRestaurants())
         using (FinlandSwedenOSMRestaurants restaurantsDb = new FinlandSwedenOSMRestaurants())
         {
             MongoEntityRepositoryBase<RestaurantsCompareList> basicData =
                             new MongoEntityRepositoryBase<RestaurantsCompareList>(restaurantsDb.DB);
             basicData.Add(compareList);
             return compareList.Id.ToString();
         }
     }
     catch (Exception e)
     {
         log.ErrorFormat("[AddRestaurantsCompareListToImportedDB] Exception={0}.", e);
         return null;
     }
 }
Exemplo n.º 4
0
 public void UpdateRestaurantOsm(RestaurantOsm restaurant)
 {
     string restId = restaurant.Id != null ? restaurant.Id.ToString() : "";
     log.DebugFormat("[UpdateRestaurantOsm] restaurant.Id={0}.", restId);
     restaurant.UpdatedAt = DateTime.UtcNow;
     //using (ImportedRestaurants restaurantsDb = new ImportedRestaurants())
     using (FinlandSwedenOSMRestaurants restaurantsDb = new FinlandSwedenOSMRestaurants())
     {
         MongoEntityRepositoryBase<RestaurantOsm> basicData =
                       new MongoEntityRepositoryBase<RestaurantOsm>(restaurantsDb.DB);
         basicData.Update(restaurant);
     }
 }
Exemplo n.º 5
0
 public RestaurantOsm GetRestaurantOsmById(string id)
 {
     log.DebugFormat("[GetRestaurantBasicById] id={0}.", id);
     //using (ImportedRestaurants restaurantsDb = new ImportedRestaurants())
     using (FinlandSwedenOSMRestaurants restaurantsDb = new FinlandSwedenOSMRestaurants())
     {
         MongoEntityRepositoryBase<RestaurantOsm> basicData =
                       new MongoEntityRepositoryBase<RestaurantOsm>(restaurantsDb.DB);
         var restaurant = basicData.GetSingle(ObjectId.Parse(id));
         return restaurant;
     }
 }
Exemplo n.º 6
0
 public List<RestaurantOsm> GetAllRestaurantsOsm()
 {
     try
     {
         log.DebugFormat("[GetAllRestaurantsOsm].");
         //using (ImportedRestaurants restaurantsDb = new ImportedRestaurants())
         using (FinlandSwedenOSMRestaurants restaurantsDb = new FinlandSwedenOSMRestaurants())
         {
             MongoEntityRepositoryBase<RestaurantOsm> basicData =
                           new MongoEntityRepositoryBase<RestaurantOsm>(restaurantsDb.DB);
             var allRestaurants = basicData.GetAll();
             List<RestaurantOsm> selected = allRestaurants.ToList();
             return selected;
         }
     }
     catch (Exception e)
     {
         log.ErrorFormat("[GetAllRestaurantsOsm] Exception={0}.", e);
         return null;
     }
 }