You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 lines
1.2 KiB

using Pursue.Extension.MongoDB;
using System.Threading.Tasks;
using Znyc.Cloudcar.Admin.MongoDb.Core.Collection;
using Znyc.Cloudcar.Admin.MongoDb.Core.IRepositorys;
namespace Znyc.Cloudcar.Admin.MongoDb.Core.Repositorys
{
public class GpsRealTimeRepository : IGpsRealTimeRepository
{
private readonly IMongoDbRepository<GpsRealTime> _gpsRealTimemongoDbRepository;
public GpsRealTimeRepository(IMongoDbService context)
{
_gpsRealTimemongoDbRepository = context.GetRepository<GpsRealTime>();
}
public async Task<bool> InsertGpsRealTime(GpsRealTime gpsRealTime)
{
await _gpsRealTimemongoDbRepository.AddAsync(gpsRealTime);
return true;
}
public async Task<GpsRealTime> GetGpsRealTime(long vehicleId)
{
GpsRealTime gpsRealTime = await _gpsRealTimemongoDbRepository.QueryOneAsync(x => x.VehicleId == vehicleId);
return gpsRealTime;
}
public async Task<bool> UpdateGpsRealTime(GpsRealTime gpsRealTime)
{
await _gpsRealTimemongoDbRepository.UpdateAsync(gpsRealTime.Id.ToString(), gpsRealTime);
return true;
}
}
}