diff --git a/SeniorAssistant/Controllers/AccountController.cs b/SeniorAssistant/Controllers/AccountController.cs index f38476e..f279c16 100644 --- a/SeniorAssistant/Controllers/AccountController.cs +++ b/SeniorAssistant/Controllers/AccountController.cs @@ -13,14 +13,11 @@ using System.Net.Http.Headers; namespace IdentityDemo.Controllers { - [ApiExplorerSettings(IgnoreApi = true)] [Route("[controller]/[action]")] public class AccountController : BaseController { private static readonly string NoteModified = "Il tuo dottore ha modificato la nota per te"; private static readonly string InvalidLogIn = "Username o Password sbagliati"; - private static readonly string AlreadyLogIn = "L'utente e' gia' loggato"; - private static readonly string UsernameDupl = "Lo username selezionato e' gia' in uso"; private static readonly string ModNotExists = "L'oggetto da modificare non esiste"; private static readonly string AlreadyPatie = "Sei gia' un paziente"; private static readonly string DocNotExists = "Il dottore selezionato non esiste"; @@ -105,11 +102,10 @@ namespace IdentityDemo.Controllers } [HttpPost] - public async Task _modify(User user) + public async Task _modify(User user, Doctor doctor) { return await LoggedAccessDataOf(user.Username, false, () => { var usr = Db.Users.Where(u => u.Username.Equals(user.Username)).FirstOrDefault(); - if (user.Password.Equals("")) user.Password = usr.Password; if (user.Avatar.Equals("")) @@ -120,8 +116,20 @@ namespace IdentityDemo.Controllers user.LastName = usr.LastName; if (user.Name.Equals("")) user.Name = usr.Name; - + Db.UpdateAsync(user); + + var doc = Db.Doctors.Where(d => d.Username.Equals(user.Username)).FirstOrDefault(); + if(doc!=null) + { + if (!doctor.PhoneNumber.Equals("")) + doc.PhoneNumber = doctor.PhoneNumber; + if (!doctor.Schedule.Equals("")) + doc.Schedule = doctor.Schedule; + + Db.UpdateAsync(doc); + } + return Json(OkJson); }); } diff --git a/SeniorAssistant/Controllers/HomeController.cs b/SeniorAssistant/Controllers/HomeController.cs index 8b3d461..bc5cf35 100644 --- a/SeniorAssistant/Controllers/HomeController.cs +++ b/SeniorAssistant/Controllers/HomeController.cs @@ -6,12 +6,12 @@ using System.Linq; namespace SeniorAssistant.Controllers { - [ApiExplorerSettings(IgnoreApi = true)] public class HomeController : BaseController { [Route("")] [Route("Home")] [Route("Index")] + [Route("Login")] public IActionResult Login() { return CheckUnAuthorized("Login"); @@ -88,7 +88,7 @@ namespace SeniorAssistant.Controllers { if (IsLogged()) { - return RedirectToAction("Profile", "Home", GetUser(HttpContext.Session.GetString(Username))); + return RedirectToAction("Profile", "Home"); } var forgot = Db.Forgot.Where(f => f.Username.Equals(username)).FirstOrDefault(); @@ -101,7 +101,8 @@ namespace SeniorAssistant.Controllers { if (!IsLogged()) { - return RedirectToAction("Login", "Home", "/" + view); + model = "/" + view; + view = "Login"; } return View(view, model); } @@ -110,7 +111,7 @@ namespace SeniorAssistant.Controllers { if (IsLogged()) { - return RedirectToAction("Profile", "Home", GetUser(HttpContext.Session.GetString(Username))); + return RedirectToAction("Profile", "Home"); } return View(view, model); } diff --git a/SeniorAssistant/Models/Users/MenuPatient.cs b/SeniorAssistant/Models/MenuPatient.cs similarity index 100% rename from SeniorAssistant/Models/Users/MenuPatient.cs rename to SeniorAssistant/Models/MenuPatient.cs diff --git a/SeniorAssistant/Views/Home/Forgot.cshtml b/SeniorAssistant/Views/Home/Forgot.cshtml index 92b09a1..9b64545 100644 --- a/SeniorAssistant/Views/Home/Forgot.cshtml +++ b/SeniorAssistant/Views/Home/Forgot.cshtml @@ -19,7 +19,7 @@ diff --git a/SeniorAssistant/Views/Home/Login.cshtml b/SeniorAssistant/Views/Home/Login.cshtml index 1d70653..cec63c7 100644 --- a/SeniorAssistant/Views/Home/Login.cshtml +++ b/SeniorAssistant/Views/Home/Login.cshtml @@ -39,7 +39,6 @@ @@ -48,7 +47,7 @@
-
+
@if (messages.Count() == 0) {

Non hai messaggi

@@ -82,7 +82,7 @@
diff --git a/SeniorAssistant/Views/Home/Profile.cshtml b/SeniorAssistant/Views/Home/Profile.cshtml index cfa6b7b..d322fe5 100644 --- a/SeniorAssistant/Views/Home/Profile.cshtml +++ b/SeniorAssistant/Views/Home/Profile.cshtml @@ -8,28 +8,30 @@
-

Dati utente

+

Dati utente

+

+ Premi qui
- -
+ +
- -
+ +
- -
+ +
@@ -37,39 +39,39 @@ {
- -
+ +
- -
+ +
}
-
+
-
+
-
+
-
+
@@ -112,19 +113,20 @@
-
Orario visite: @doctor.Schedule
+
Orario visite: @doctor.Schedule
-

@Model.Pat.Notes

+ +
- + } else { @@ -137,7 +139,9 @@ if (docData != null) // is DOC { // see all the patient of the doc - title = "Lista dei pazienti"; +
+

Lista dei pazienti

+
var patients = (from u in db.Users join p in db.Patients on u.Username equals p.Username where p.Doctor.Equals(docData.Username) @@ -255,7 +259,6 @@ $(".old-data").toggleClass("hide"); $("#image-uploader").toggle(); - $("#update-user").toggle(); }); $("#update-user").on("click", function () { @@ -279,7 +282,9 @@ Name: name, Lastname: lastname, Password: password, - Email: email, + Email: email + }, + Doctor: { Schedule: schedule, PhoneNumber: phone } @@ -287,7 +292,7 @@ dataType: "json", type: "POST", success: function (data) { - var msg = $("#msg-reg"); + var msg = $("#msg"); if (data.success) { window.location.reload(); } else { diff --git a/SeniorAssistant/Views/Home/Register.cshtml b/SeniorAssistant/Views/Home/Register.cshtml index 51e90b8..2587bb2 100644 --- a/SeniorAssistant/Views/Home/Register.cshtml +++ b/SeniorAssistant/Views/Home/Register.cshtml @@ -51,9 +51,10 @@
- +
- + +
@@ -72,10 +73,9 @@ @@ -84,6 +84,11 @@ } + +
+ @if (isDoc) + { +
+ + + +

+
+ } +
+ + + -
- + +
+ @if (isDoc) + { +
+ + + +
+ + + } +
+ + +
+