diff --git a/MIAUI/MIAUI/Model/Task.cs b/MIAUI/MIAUI/Model/Task.cs index b417bf4..d004378 100644 --- a/MIAUI/MIAUI/Model/Task.cs +++ b/MIAUI/MIAUI/Model/Task.cs @@ -1,6 +1,6 @@ namespace MIAUI.Model; -[Table("tasks")] +[Table ("tasks")] public class Task { [PrimaryKey, AutoIncrement] @@ -8,23 +8,19 @@ public class Task public string Details { get; set; } = String.Empty; public string TaskName { get; set; } //public ObservableCollection Subtasks { get; set; } - public int UserId { get; set; } + public string UserId { get; set; } public Task(string taskName) { TaskName = taskName; //Subtasks = new ObservableCollection(); } - public Task() - { - } public Task(string taskName, string details) { Details = details; TaskName = taskName; //Subtasks = new ObservableCollection(); } -} - +} diff --git a/MIAUI/TasksRepository.cs b/MIAUI/TasksRepository.cs new file mode 100644 index 0000000..8a189a7 --- /dev/null +++ b/MIAUI/TasksRepository.cs @@ -0,0 +1,51 @@ +using SQLite; +using MIAUI.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MIAUI; + +public class TasksRepository +{ + string _dbPath; + public string StatusMessage { get; set; } + + private SQLiteConnection conn; + + private void Init() + { + if (conn != null) + return; + + conn = new SQLiteConnection(_dbPath); + conn.CreateTable(); + } + + public TasksRepository(string dbPath) + { + _dbPath = dbPath; + } + public void AddNewTask(string taskName) + { + int result = 0; + try + { + Init(); + // basic validation to ensure a name was entered + if (string.IsNullOrEmpty(taskName)) + throw new Exception("Valid name required"); + + result = conn.Insert(new Model.Task(taskName)); + result = 0; + + StatusMessage = string.Format("{0} record(s) added (Name: {1})", result, taskName); + } + catch (Exception ex) + { + StatusMessage = string.Format("Failed to add {0}. Error: {1}", taskName, ex.Message); + } + } +} diff --git a/screenshots/azureAD.jpg b/screenshots/azureAD.jpg new file mode 100644 index 0000000..812d037 Binary files /dev/null and b/screenshots/azureAD.jpg differ diff --git a/screenshots/azureB2C.jpg b/screenshots/azureB2C.jpg new file mode 100644 index 0000000..144cb2e Binary files /dev/null and b/screenshots/azureB2C.jpg differ diff --git a/screenshots/miaui.jpg b/screenshots/miaui.jpg new file mode 100644 index 0000000..40596a7 Binary files /dev/null and b/screenshots/miaui.jpg differ