Ejemplo n.º 1
0
 public async Task DeleteAsync(TrackingUrlEntity entity)
 {
     try
     {
         await _collection.DeleteAsync(entity.Id);
     }
     catch (Exception e)
     {
         throw new ApplicationException(string.Format("Mongo driver failure: {0}", e));
     }
 }
Ejemplo n.º 2
0
        public async Task<TrackingUrlEntity> EditAsync(TrackingUrlEntity entity)
        {
            TrackingUrlEntity result;
            try
            {
                result = await _collection.UpdateAsync(entity);
            }
            catch (Exception e)
            {
                throw new ApplicationException(string.Format("Mongo driver failure: {0}", e));
            }

            return result;
        }
Ejemplo n.º 3
0
        public async Task<TrackingUrlEntity> AddAsync(TrackingUrlEntity entity)
        {
            if (string.IsNullOrEmpty(entity.Id))
            {
                // Generating new integer id
                entity.Id = _idGenerator.GenerateId().ToString(CultureInfo.InvariantCulture);
            }

            TrackingUrlEntity result;
            try
            {
                result = await _collection.AddAsync(entity);
            }
            catch (Exception e)
            {
                throw new ApplicationException(string.Format("Mongo driver failure: {0}", e));
            }

            return result;
        }
Ejemplo n.º 4
0
 public Task<TrackingUrlEntity> GetAsync(TrackingUrlEntity entity)
 {
     return _collection.GetAsync(entity.Id);
 }