Esempio n. 1
0
 public IEnumerable<Group> GetAllGroups()
 {
     using (var conn = new DatabaseConnection())
     {
         return null;
     }
 }
Esempio n. 2
0
 public Email GetEmail(int id)
 {
     using (var conn = new DatabaseConnection())
     {
         return conn.SQLiteConnection.Query<Email>($"SELECT * FROM Emails WHERE Id = {id}").FirstOrDefault();
     }
 }
Esempio n. 3
0
 public IEnumerable<Email> GetAllEmails()
 {
     using (var conn = new DatabaseConnection())
     {
         return conn.SQLiteConnection.Query<Email>("SELECT * FROM Emails");
     }
 }
Esempio n. 4
0
 public void SetEmail(Email email)
 {
     using (var conn = new DatabaseConnection())
     {
         if (email.Id > 0)
         {
             // Todo?
         }
         else
         {
             conn.SQLiteConnection.Execute(@"INSERT INTO Emails ([Id], [GroupId], [From], [To], [Subject], [BodyHtml]) VALUES (@Id, @GroupId, @From, @To, @Subject, @BodyHtml)", email);
         }
     }
 }
Esempio n. 5
0
        public void SeedDatabase()
        {
            using (var connection = new DatabaseConnection())
            {
                connection.SQLiteConnection.Open();

                connection.SQLiteConnection.Execute(@"
                    CREATE TABLE IF NOT EXISTS [Emails] (
                        [Id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
                        [GroupId] INTEGER DEFAULT 0,
                        [From] NVARCHAR(100) NOT NULL,
                        [To] NVARCHAR(100) NOT NULL,
                        [Subject] NVARCHAR(200) NOT NULL,
                        [BodyText] NVARCHAR(5000) NULL,
                        [BodyHtml] NVARCHAR(5000) NULL
                    )");
            }
        }