diff --git a/FIT5032-Assignment/Controllers/HomeController.cs b/FIT5032-Assignment/Controllers/HomeController.cs index 3a03123..139c0aa 100644 --- a/FIT5032-Assignment/Controllers/HomeController.cs +++ b/FIT5032-Assignment/Controllers/HomeController.cs @@ -334,7 +334,7 @@ namespace FIT5032_Assignment.Controllers { } // Check if the email have a patient profile - var db = new Database1Entities(); + var dbEntity = new Database1Entities(); // Find the account associated with the email var app_id = "ZHM5whW5xsZEczTn2loffzjN"; var url = $"https://api.passage.id/v1/apps/{app_id}/users?identifier={model.patientEmail}"; @@ -344,13 +344,13 @@ namespace FIT5032_Assignment.Controllers { return View(model); } var patientId = JsonConvert.DeserializeObject(res).Users[0].Id; - var patientCredential = db.Credentials.Where(c => (c.uniqueIdCode == patientId) && (c.provider == 0)); + var patientCredential = dbEntity.Credentials.Where(c => (c.uniqueIdCode == patientId) && (c.provider == 0)); if (patientCredential.Count() == 0) { ModelState.AddModelError("patientEmail", "No patient found"); return View(model); } var patientUuid = patientCredential.First().user; - var patient = db.Users.Where(u => u.uuid == patientUuid); + var patient = dbEntity.Users.Where(u => u.uuid == patientUuid); if (patient.Count() == 0 || patient.First().role != 1) { ModelState.AddModelError("patientEmail", "No patient found"); return View(model); @@ -383,6 +383,7 @@ namespace FIT5032_Assignment.Controllers { file = fileName, status = 0, }; + db.SaveChanges(); // Send attached email with mailgun var doctorName = user.displayName; diff --git a/FIT5032-Assignment/Views/Home/Index.cshtml b/FIT5032-Assignment/Views/Home/Index.cshtml index b322e8d..6967d16 100644 --- a/FIT5032-Assignment/Views/Home/Index.cshtml +++ b/FIT5032-Assignment/Views/Home/Index.cshtml @@ -1,31 +1,31 @@ @{ - ViewBag.Title = "Home Page"; - // Check login status - bool loginStatus = false; + ViewBag.Title = "Home Page"; + // Check login status + bool loginStatus = false; - // cookie + // cookie - if (Request.Cookies["psg_auth_token"] == null) - { - loginStatus = false; - } - else - { - loginStatus = true; - } + if (Request.Cookies["psg_auth_token"] == null) { + loginStatus = false; + } else { + loginStatus = true; + } } @section Scripts { - @Scripts.Render("~/bundles/jqueryval") + @Scripts.Render("~/bundles/jqueryval") } -@if (loginStatus) -{ +@if (loginStatus) { Avatar

Welcome back, @ViewBag.displayname

Email address john.appleseed@mac.com

Role @ViewBag.role

+
+

Features

+

MyImages

+