Files
DMS/Data/Repositories/DevicesRepositories.cs

29 lines
732 B
C#
Raw Normal View History

2025-06-10 22:13:06 +08:00
using PMSWPF.Data.Entities;
namespace PMSWPF.Data.Repositories;
public class DevicesRepositories:BaseRepositories
{
public DevicesRepositories()
{
}
public async Task<int> Add(DbDevice dbDevice)
2025-06-10 22:13:06 +08:00
{
return await _db.Insertable<DbDevice>(dbDevice).ExecuteCommandAsync();
2025-06-10 22:13:06 +08:00
}
public async Task<List<DbDevice>> GetAll()
2025-06-10 22:13:06 +08:00
{
return await _db.Queryable<DbDevice>().ToListAsync();
2025-06-10 22:13:06 +08:00
}
public async Task<DbDevice> GetById(int id)
2025-06-10 22:13:06 +08:00
{
return await _db.Queryable<DbDevice>().FirstAsync(p=>p.Id == id);
2025-06-10 22:13:06 +08:00
}
public async Task<int> DeleteById(int id)
{
return await _db.Deleteable<DbDevice>(new DbDevice() { Id = id }).ExecuteCommandAsync();
2025-06-10 22:13:06 +08:00
}
}