Camera Information System
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.

51 lines
1.3 KiB

using Newtonsoft.Json.Linq;
namespace Cis.Application.Tb;
public class TbPtzCameraService : ITransient
{
private readonly SqlSugarRepository<TbPtzCamera> _tbPtzCameraRep;
public TbPtzCameraService(SqlSugarRepository<TbPtzCamera> tbPtzCameraRep)
{
_tbPtzCameraRep = tbPtzCameraRep;
}
public async Task<TbPtzCamera> Get(int id)
{
TbPtzCamera entity = await _tbPtzCameraRep.GetByIdAsync(id);
return entity;
}
public async Task<List<TbPtzCamera>> GetList(string queryJson = "")
{
JObject queryObj = !string.IsNullOrEmpty(queryJson) ? queryJson.ToJObject():default;
List<TbPtzCamera> list = await _tbPtzCameraRep.AsQueryable()
.ToListAsync();
return list;
}
public async Task<List<TbPtzCamera>> GetPageList(string pagination, string queryJson = "")
{
Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject();
List<TbPtzCamera> list = await _tbPtzCameraRep.AsQueryable()
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}
public async Task Add(TbPtzCamera entity)
{
await _tbPtzCameraRep.InsertAsync(entity);
}
public async Task Update(TbPtzCamera entity)
{
await _tbPtzCameraRep.UpdateAsync(entity);
}
public async Task Delete(TbPtzCamera entity)
{
await _tbPtzCameraRep.DeleteAsync(entity);
}
}