Innovenergy_trunk/csharp/App/Backend/Database/Installation.cs

36 lines
894 B
C#

using Innovenergy.Backend.Model;
using Innovenergy.Backend.Utils;
using SQLite;
namespace Innovenergy.Backend.Database;
public partial class Db
{
private TableQuery<Installation> Installations => _Db.Table<Installation>();
public Int32 NbInstallations => Installations.Count();
public Installation? GetInstallationById(Int64 id) => Installations
.FirstOrDefault(u => u.Id == id);
public Result CreateInstallation(Installation installation)
{
return Create(installation);
}
public Result UpdateInstallation(Installation installation)
{
return Update(installation);
}
public Result DeleteInstallation(Installation installation)
{
User2Installation.Delete(i => i.InstallationId == installation.Id);
return Delete(installation);
}
}