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)); } }
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; }
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; }
public Task<TrackingUrlEntity> GetAsync(TrackingUrlEntity entity) { return _collection.GetAsync(entity.Id); }