Compare commits
No commits in common. "6388899f8b69dceca6779992cf3dbbde9f1b0eb5" and "1c600e8d4d7078a890acba9289cb075df3903a8d" have entirely different histories.
6388899f8b
...
1c600e8d4d
|
@ -5,21 +5,18 @@ using System.Web;
|
|||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace FIT5032_Assignment {
|
||||
public class RouteConfig {
|
||||
public static void RegisterRoutes(RouteCollection routes) {
|
||||
namespace FIT5032_Assignment
|
||||
{
|
||||
public class RouteConfig
|
||||
{
|
||||
public static void RegisterRoutes(RouteCollection routes)
|
||||
{
|
||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||
|
||||
// Put Home folder into root route independently without keyword "Home"
|
||||
routes.MapRoute(
|
||||
name: "Home",
|
||||
url: "{action}",
|
||||
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Actions",
|
||||
url: "{controller}/{action}/{id}",
|
||||
url: "{action}/{id}",
|
||||
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity.Core.Common.CommandTrees;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using FIT5032_Assignment.Models;
|
||||
using System.Data.Entity;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace FIT5032_Assignment.Controllers {
|
||||
public class AppointmentsController : Controller {
|
||||
private Database1Entities db = new Database1Entities();
|
||||
// GET: Appointments
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
}
|
||||
|
||||
// GET: Appointments/Details/5
|
||||
public ActionResult Details(int id) {
|
||||
return View();
|
||||
}
|
||||
|
||||
// GET: Appointments/Create
|
||||
public ActionResult Create() {
|
||||
// Pass a dropdown list for all doctors
|
||||
List<Doctors> doctors = db.Doctors.ToList();
|
||||
// Create a tuple for put uuid and displayName into it
|
||||
List<Tuple<string, string>> doctorsList = new List<Tuple<string, string>>();
|
||||
List<Users> users = db.Users.ToList();
|
||||
for (int i = 0; i < doctors.Count; i++) {
|
||||
// Get displayName from users table
|
||||
string displayName = users.Find(user => user.uuid == doctors[i].user).displayName;
|
||||
Tuple<string, string> doctor = new Tuple<string, string>(doctors[i].user, displayName);
|
||||
doctorsList.Add(doctor);
|
||||
}
|
||||
ViewBag.doctorsList = new SelectList(doctorsList, "Item1", "Item2");
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Appointments/Create
|
||||
[HttpPost]
|
||||
public ActionResult Create(FormCollection collection) {
|
||||
try {
|
||||
// TODO: Add insert logic here
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch {
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
// GET: Appointments/Edit/5
|
||||
public ActionResult Edit(int id) {
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Appointments/Edit/5
|
||||
[HttpPost]
|
||||
public ActionResult Edit(int id, FormCollection collection) {
|
||||
try {
|
||||
// TODO: Add update logic here
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch {
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
// GET: Appointments/Delete/5
|
||||
public ActionResult Delete(int id) {
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Appointments/Delete/5
|
||||
[HttpPost]
|
||||
public ActionResult Delete(int id, FormCollection collection) {
|
||||
try {
|
||||
// TODO: Add delete logic here
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch {
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -255,7 +255,8 @@ namespace FIT5032_Assignment.Controllers {
|
|||
});
|
||||
db.SaveChanges();
|
||||
} else {
|
||||
db.Doctors.Add(new Doctors {
|
||||
db.Doctors.Add(new Doctors
|
||||
{
|
||||
user = userUuid,
|
||||
bio = "",
|
||||
});
|
||||
|
@ -333,7 +334,7 @@ namespace FIT5032_Assignment.Controllers {
|
|||
}
|
||||
|
||||
// Check if the email have a patient profile
|
||||
var dbEntity = new Database1Entities();
|
||||
var db = 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}";
|
||||
|
@ -343,13 +344,13 @@ namespace FIT5032_Assignment.Controllers {
|
|||
return View(model);
|
||||
}
|
||||
var patientId = JsonConvert.DeserializeObject<PassageUserFindReply>(res).Users[0].Id;
|
||||
var patientCredential = dbEntity.Credentials.Where(c => (c.uniqueIdCode == patientId) && (c.provider == 0));
|
||||
var patientCredential = db.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 = dbEntity.Users.Where(u => u.uuid == patientUuid);
|
||||
var patient = db.Users.Where(u => u.uuid == patientUuid);
|
||||
if (patient.Count() == 0 || patient.First().role != 1) {
|
||||
ModelState.AddModelError("patientEmail", "No patient found");
|
||||
return View(model);
|
||||
|
@ -382,7 +383,6 @@ namespace FIT5032_Assignment.Controllers {
|
|||
file = fileName,
|
||||
status = 0,
|
||||
};
|
||||
db.SaveChanges();
|
||||
|
||||
// Send attached email with mailgun
|
||||
var doctorName = user.displayName;
|
||||
|
|
|
@ -184,7 +184,6 @@
|
|||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="Controllers\AppointmentsController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
|
@ -316,11 +315,8 @@
|
|||
<Content Include="Views\Home\CompleteProfile.cshtml" />
|
||||
<Content Include="Views\Home\View.cshtml" />
|
||||
<Content Include="Views\Home\ImageUpload.cshtml" />
|
||||
<Content Include="Views\Appointments\Index.cshtml" />
|
||||
<Content Include="Views\Appointments\Create.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\Default\" />
|
||||
<Folder Include="Views\Test\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<Controller_SelectedScaffolderID>MvcControllerWithActionsScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderID>MvcControllerWithContextScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
|
||||
<WebStackScaffolding_LayoutPageFile>~/Views/Shared/_Layout.cshtml</WebStackScaffolding_LayoutPageFile>
|
||||
|
@ -22,8 +22,6 @@
|
|||
<View_SelectedScaffolderID>MvcViewScaffolder</View_SelectedScaffolderID>
|
||||
<View_SelectedScaffolderCategoryPath>root/Common/MVC/View</View_SelectedScaffolderCategoryPath>
|
||||
<WebStackScaffolding_ViewDialogWidth>600</WebStackScaffolding_ViewDialogWidth>
|
||||
<_SelectedScaffolderID>MvcControllerEmptyScaffolder</_SelectedScaffolderID>
|
||||
<_SelectedScaffolderCategoryPath>root/Common</_SelectedScaffolderCategoryPath>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
@model FIT5032_Assignment.Models.Appointments
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Create";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<h2>Create</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm()) {
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>Appointments</h4>
|
||||
<hr />
|
||||
<!-- Dropdown menu for select a doctor -->
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.responsibleBy, "Select a doctor", htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.DropDownList("user.displayName", @ViewBag.doctorsList as SelectList, htmlAttributes: new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(model => model.responsibleBy, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
@{
|
||||
ViewBag.Title = "Appointments";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<h2>Appointments</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="./Create">Make a new appointment</a></li>
|
||||
</ul>
|
|
@ -5,9 +5,12 @@
|
|||
|
||||
// cookie
|
||||
|
||||
if (Request.Cookies["psg_auth_token"] == null) {
|
||||
if (Request.Cookies["psg_auth_token"] == null)
|
||||
{
|
||||
loginStatus = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
loginStatus = true;
|
||||
}
|
||||
|
||||
|
@ -17,15 +20,12 @@
|
|||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
|
||||
@if (loginStatus) {
|
||||
@if (loginStatus)
|
||||
{
|
||||
<img src="@ViewBag.avatar" alt="Avatar" style="width:200px" />
|
||||
<h1>Welcome back, @ViewBag.displayname</h1>
|
||||
<p><b>Email address</b> <span id="emailfield">john.appleseed@mac.com</span></p>
|
||||
<p><b>Role</b> @ViewBag.role</p>
|
||||
<hr />
|
||||
<h2>Features</h2>
|
||||
<p><a href="/Appointments/Index">Appointments</a></p>
|
||||
<hr />
|
||||
<p><button id="logoutbutton">Log out</button></p>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||||
|
|
Loading…
Reference in New Issue
Block a user