2023-03-15 13:38:06 +00:00
|
|
|
using InnovEnergy.App.Backend.DataTypes;
|
|
|
|
using InnovEnergy.App.Backend.DataTypes.Methods;
|
|
|
|
using InnovEnergy.App.Backend.Relations;
|
|
|
|
|
|
|
|
|
|
|
|
namespace InnovEnergy.App.Backend.Database;
|
|
|
|
|
|
|
|
|
|
|
|
public static partial class Db
|
|
|
|
{
|
|
|
|
public static Boolean Create(Installation installation)
|
|
|
|
{
|
|
|
|
// SQLite wrapper is smart and *modifies* t's Id to the one generated (autoincrement) by the insertion
|
|
|
|
return Connection.Insert(installation) > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Boolean Create(Folder folder)
|
|
|
|
{
|
|
|
|
return Connection.Insert(folder) > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Boolean Create(User user)
|
|
|
|
{
|
2023-03-16 15:52:20 +00:00
|
|
|
if (GetUserByEmail(user.Email) is not null)
|
2023-03-15 13:38:06 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
user.Password = user.SaltAndHashPassword(user.Password);
|
|
|
|
|
|
|
|
return Connection.Insert(user) > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Boolean Create(Session session)
|
|
|
|
{
|
|
|
|
return Connection.Insert(session) > 0;
|
|
|
|
}
|
|
|
|
|
2023-03-16 08:25:36 +00:00
|
|
|
public static Boolean Create(InstallationAccess installationAccess)
|
2023-03-16 08:15:59 +00:00
|
|
|
{
|
2023-03-16 08:25:36 +00:00
|
|
|
return Connection.Insert(installationAccess) > 0;
|
2023-03-16 08:15:59 +00:00
|
|
|
}
|
|
|
|
|
2023-03-16 08:25:36 +00:00
|
|
|
public static Boolean Create(FolderAccess folderAccess)
|
2023-03-16 08:15:59 +00:00
|
|
|
{
|
2023-03-16 08:25:36 +00:00
|
|
|
return Connection.Insert(folderAccess) > 0;
|
2023-03-16 08:15:59 +00:00
|
|
|
}
|
2023-03-15 13:38:06 +00:00
|
|
|
}
|