diff --git a/.gitignore b/.gitignore index 3ea5d77..5ccda99 100644 --- a/.gitignore +++ b/.gitignore @@ -263,3 +263,5 @@ __pycache__/ SeniorAssistant/SeniorAssistant/wwwroot/* /SeniorAssistant/Controllers/TestController.cs /SeniorAssistant/Views/Test/* +/SeniorAssistant/Views/Home/Calendar.cshtml +/SeniorAssistant/Views/Home/Calendar.cshtml.cs diff --git a/SeniorAssistant/Controllers/AccountController.cs b/SeniorAssistant/Controllers/AccountController.cs index 0eb61e9..6dee372 100644 --- a/SeniorAssistant/Controllers/AccountController.cs +++ b/SeniorAssistant/Controllers/AccountController.cs @@ -6,81 +6,150 @@ using LinqToDB; using System.Linq; using System; using SeniorAssistant.Models.Users; -using SeniorAssistant.Data; using System.Threading.Tasks; +using System.IO; +using System.Collections.Generic; +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"; private static readonly string InsertAsDoct = "Ti ha inserito come il suo dottore: "; + private static readonly string DefaultImage = "/uploads/default.jpg"; + private static readonly string UploadsDirec = "/uploads/"; [HttpPost] - public async Task _login(string username, string password) + public async Task _login(string username, string password) { - var result = await (from u in Db.Users - where u.Username.Equals(username) - && u.Password.Equals(password) - select u).ToListAsync(); - - if (result.Count == 1) + try { - User user = result.First(); - HttpContext.Session.SetString(Username, username); - HttpContext.Session.SetString("email", user.Email); - HttpContext.Session.SetString("name", user.Name); - HttpContext.Session.SetString("lastname", user.LastName); - - var isDoc = (from d in Db.Doctors - where d.Username.Equals(username) - select d).ToArray().FirstOrDefault() != null; - HttpContext.Session.SetString("role", isDoc? "doctor":"patient"); + var user = await (from u in Db.Users + where u.Username.Equals(username) + && u.Password.Equals(password) + select u).FirstOrDefaultAsync(); - return Json(OkJson); + if (user != null) + { + HttpContext.Session.SetString(Username, username); + HttpContext.Session.SetString("email", user.Email); + HttpContext.Session.SetString("name", user.Name); + HttpContext.Session.SetString("lastname", user.LastName); + HttpContext.Session.SetString("avatar", user.Avatar ?? DefaultImage); + + var isDoc = (from d in Db.Doctors + where d.Username.Equals(username) + select d).ToArray().FirstOrDefault() != null; + HttpContext.Session.SetString("role", isDoc ? "doctor" : "patient"); + + return Json(OkJson); + } + return Json(new JsonResponse() + { + Success = false, + Message = InvalidLogIn + }); } - return Json(new JsonResponse() + catch (Exception e) { - Success = false, - Message = InvalidLogIn - }); + return Json(new JsonResponse() + { + Success = false, + Message = e.Message + " " +e.Source + "
"+ e.StackTrace + }); + } } [HttpPost] - public ActionResult _logout() + public IActionResult _logout() { HttpContext.Session.Clear(); return Json(OkJson); } [HttpPost] - public async Task _register(User user) + public async Task _register(User user, Forgot forgot, string code = "") { try { + user.Avatar = DefaultImage; + forgot.Username = user.Username; Db.Insert(user); + Db.Insert(forgot); + if (code != null && code.Equals("444442220")) + { + Db.Insert(new Doctor + { + Username = user.Username + }); + }; return await _login(user.Username, user.Password); } - catch + catch (Exception e) { return Json(new JsonResponse() { Success = false, - Message = UsernameDupl + Message = e.Message }); } } [HttpPost] - public async Task _notification(string username, string message, string redirectUrl = "#") + 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 == null) + user.Password = usr.Password; + if (user.Avatar == null) + user.Avatar = usr.Avatar; + if (user.Email == null) + user.Email = usr.Email; + if (user.LastName == null) + user.LastName = usr.LastName; + if (user.Name == null) + 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 != null) + doc.PhoneNumber = doctor.PhoneNumber; + if (doctor.Schedule != null) + doc.Schedule = doctor.Schedule; + if (doctor.Location != null) + doc.Location = doctor.Location; + + Db.UpdateAsync(doc); + } + + return Json(OkJson); + }); + } + + [HttpPost] + public async Task _checkQuestion(string username, string answer) + { + var forgot = Db.Forgot.Where(f => f.Username.Equals(username) && f.Answer.Equals(answer)).FirstOrDefault(); + if(forgot != null) + { + var user = (from u in Db.Users where u.Username.Equals(forgot.Username) select u).FirstOrDefault(); + return await _login(user.Username, user.Password); + } + return Json(new JsonResponse(false, "Risposta sbagliata")); + } + + [HttpPost] + public async Task _notification(string username, string message, string redirectUrl = "#") { return await LoggedAction(() => { @@ -97,7 +166,7 @@ namespace IdentityDemo.Controllers } [HttpPut] - public async Task _notification(int id) + public async Task _notification(int id) { return await LoggedAction(() => { @@ -119,7 +188,7 @@ namespace IdentityDemo.Controllers } [HttpPost] - public async Task _addDoc(string doctor) + public async Task _addDoc(string doctor) { return await LoggedAction(() => { @@ -146,13 +215,13 @@ namespace IdentityDemo.Controllers Username = username }); - var a = _notification(doctor, InsertAsDoct + username); + var a = _notification(doctor, InsertAsDoct + username, "/user/" + username); return Json(OkJson); }); } [HttpPost] - public async Task _sendMessage(string receiver, string body) + public async Task _sendMessage(string receiver, string body) { return await LoggedAction(() => { string username = HttpContext.Session.GetString(Username); @@ -171,7 +240,7 @@ namespace IdentityDemo.Controllers } [HttpPut] - public async Task _addNote(string patient, string text) + public async Task _addNote(string patient, string text) { return await LoggedAccessDataOf(patient, true, () => { @@ -185,7 +254,7 @@ namespace IdentityDemo.Controllers } [HttpPut] - public async Task _minHeartToPatient(string patient, int value) + public async Task _minHeartToPatient(string patient, int value) { return await LoggedAccessDataOf(patient, true, () => { @@ -198,7 +267,7 @@ namespace IdentityDemo.Controllers } [HttpPut] - public async Task _maxHeartToPatient(string patient, int value) + public async Task _maxHeartToPatient(string patient, int value) { return await LoggedAccessDataOf(patient, true, () => { @@ -209,5 +278,83 @@ namespace IdentityDemo.Controllers return Json(OkJson); }); } + + [HttpPost] + public async Task _save(IEnumerable files) + { + return await LoggedAction(() => + { + if (files != null) + { + var loggedUser = HttpContext.Session.GetString(Username); + foreach (var file in files) + { + var fileContent = ContentDispositionHeaderValue.Parse(file.ContentDisposition); + + // We are only interested in the file name. + var fileName = loggedUser + Path.GetExtension(fileContent.FileName.ToString().Trim('"')); + + var physicalPath = "wwwroot" + UploadsDirec; + Directory.CreateDirectory(physicalPath); + + physicalPath = Path.Combine(physicalPath, fileName); + var externalPath = Path.Combine(UploadsDirec, fileName); + + using (var fileStream = new FileStream(physicalPath, FileMode.Create)) + { + file.CopyTo(fileStream); + } + + var user = (from u in Db.Users + where u.Username.Equals(loggedUser) + select u).FirstOrDefault(); + user.Avatar = externalPath; + HttpContext.Session.SetString("avatar", externalPath); + Db.Update(user); + } + } + + return Json(OkJson); + /* + + if (file.Length > 0) + { + var fileContent = ContentDispositionHeaderValue.Parse(file.ContentDisposition); + + var name = loggedUser + ".jpg"; + var path = Path.Combine(("/uploads/"), name); + var stream = new FileStream(path, FileMode.Create); + file.CopyTo(stream); + var user = (from u in Db.Users + where u.Username.Equals(loggedUser) + select u).FirstOrDefault(); + user.Avatar = path; + + Db.Update(User); + } + + return Json(OkJson); + }); + + /* + var loggedUser = HttpContext.Session.GetString(Username); + + long size = file.Length; + + // full path to file in temp location + var filePathPart = Path.GetDirectoryName("~/AdminLTE-2.4.3/dist/img/"); + var fileName = Path.GetFileName(loggedUser + ".jpg"); + var filePath = Path.Combine(filePathPart,fileName); + if (size > 0) + { + using (var stream = new FileStream(filePath, FileMode.Create)) + { + await file.CopyToAsync(stream); + } + } + return Json(new JsonResponse()); + */ + }); + } } } \ No newline at end of file diff --git a/SeniorAssistant/Controllers/HomeController.cs b/SeniorAssistant/Controllers/HomeController.cs index c47e47d..bc5cf35 100644 --- a/SeniorAssistant/Controllers/HomeController.cs +++ b/SeniorAssistant/Controllers/HomeController.cs @@ -6,16 +6,15 @@ using System.Linq; namespace SeniorAssistant.Controllers { - [ApiExplorerSettings(IgnoreApi = true)] public class HomeController : BaseController { [Route("")] [Route("Home")] [Route("Index")] - public IActionResult Index() + [Route("Login")] + public IActionResult Login() { - string username = HttpContext.Session.GetString(Username); - return View("Index", GetUser(username)); + return CheckUnAuthorized("Login"); } [Route("Heartbeat")] @@ -45,6 +44,23 @@ namespace SeniorAssistant.Controllers [Route("User/{User}")] public IActionResult SingleUser(string user) { + try + { + string rm = HttpContext.Request.Query["removePatient"]; + string usr = HttpContext.Session.GetString(Username); + + var pt = Db.Patients + .Where(p => p.Username.Equals(rm) && p.Doctor.Equals(usr)) + .FirstOrDefault(); + var mp = Db.MenuPatients + .Where(m => m.PatientUsername.Equals(rm) && m.Username.Equals(usr)) + .FirstOrDefault(); + + Db.Delete(pt); + Db.Delete(mp); + } + catch { } + return CheckAuthorized("User", GetUser(user)); } @@ -54,6 +70,52 @@ namespace SeniorAssistant.Controllers return CheckAuthorized("Message", GetUser(user)); } + [Route("Profile")] + public IActionResult Profile() + { + string username = HttpContext.Session.GetString(Username); + return CheckAuthorized("Profile", GetUser(username)); + } + + [Route("Register")] + public IActionResult Register() + { + return CheckUnAuthorized("Register"); + } + + [Route("Forgot")] + public IActionResult Forgot(string username = "") + { + if (IsLogged()) + { + return RedirectToAction("Profile", "Home"); + } + + var forgot = Db.Forgot.Where(f => f.Username.Equals(username)).FirstOrDefault(); + if (forgot == null) + return View("Login", "Utente non esiste"); + return View("Forgot", forgot); + } + + protected IActionResult CheckAuthorized(string view, object model = null) + { + if (!IsLogged()) + { + model = "/" + view; + view = "Login"; + } + return View(view, model); + } + + protected IActionResult CheckUnAuthorized(string view, object model = null) + { + if (IsLogged()) + { + return RedirectToAction("Profile", "Home"); + } + return View(view, model); + } + private User GetUser(string username) { return Db.Users @@ -62,12 +124,5 @@ namespace SeniorAssistant.Controllers .Where(u => u.Username.Equals(username)) .FirstOrDefault(); } - - private IActionResult CheckAuthorized(string view, object model = null) - { - if (!IsLogged()) - return View("Index", "/" + view); - return View(view, model); - } } } \ No newline at end of file diff --git a/SeniorAssistant/Controllers/Services/BaseController.cs b/SeniorAssistant/Controllers/Services/BaseController.cs index 092544b..aca0d2e 100644 --- a/SeniorAssistant/Controllers/Services/BaseController.cs +++ b/SeniorAssistant/Controllers/Services/BaseController.cs @@ -5,6 +5,7 @@ using SeniorAssistant.Models.Users; using System.Linq; using System; using System.Threading.Tasks; +using SeniorAssistant.Models; namespace SeniorAssistant.Controllers { @@ -37,8 +38,8 @@ namespace SeniorAssistant.Controllers { return HttpContext.Session.GetString(Username) != null; } - - protected async Task LoggedAction(Func success) + + protected async Task LoggedAction(Func success) { try { @@ -56,16 +57,12 @@ namespace SeniorAssistant.Controllers return Json(new JsonResponse() { Success = false, - Message = ExceptionSer + Environment.NewLine + - e.Message + Environment.NewLine + - e.StackTrace + Environment.NewLine + - e.TargetSite + Environment.NewLine + - e.InnerException + Message = e.Message }); } } - protected async Task LoggedAccessDataOf(string username, bool patients, Func success) + protected async Task LoggedAccessDataOf(string username, bool patients, Func success) { return await LoggedAction(() => { diff --git a/SeniorAssistant/Data/SeniorDataContext.cs b/SeniorAssistant/Data/SeniorDataContext.cs index 389283a..cc2af5d 100644 --- a/SeniorAssistant/Data/SeniorDataContext.cs +++ b/SeniorAssistant/Data/SeniorDataContext.cs @@ -1,5 +1,4 @@ -using System; -using System.Linq; +using System.Linq; using LinqToDB; using LinqToDB.Data; using LinqToDB.DataProvider; @@ -23,6 +22,8 @@ namespace SeniorAssistant.Data public ITable Patients => GetTable(); public ITable Notifications => GetTable(); public ITable Messages => GetTable(); + public ITable Forgot => GetTable(); + public ITable MenuPatients => GetTable(); public T[] GetLastMessages(ITable table, string receiver, ref int numNotSeen, int max = 10) where T : IHasMessage diff --git a/SeniorAssistant/Models/Forgot.cs b/SeniorAssistant/Models/Forgot.cs new file mode 100644 index 0000000..b31a834 --- /dev/null +++ b/SeniorAssistant/Models/Forgot.cs @@ -0,0 +1,16 @@ +using LinqToDB.Mapping; + +namespace SeniorAssistant.Models +{ + public class Forgot : IHasUsername + { + [Column(IsPrimaryKey = true, CanBeNull = false)] + public string Username { get; set; } + + [Column(CanBeNull = false)] + public string Question { get; set; } + + [Column(CanBeNull = false)] + public string Answer { get; set; } + } +} diff --git a/SeniorAssistant/Models/MenuPatient.cs b/SeniorAssistant/Models/MenuPatient.cs new file mode 100644 index 0000000..e502825 --- /dev/null +++ b/SeniorAssistant/Models/MenuPatient.cs @@ -0,0 +1,18 @@ +using LinqToDB.Mapping; +using Newtonsoft.Json; + +namespace SeniorAssistant.Models.Users +{ + public class MenuPatient : IHasUsername + { + [Column(IsPrimaryKey = true, CanBeNull = false)] + public string Username { get; set; } + + [Column(IsPrimaryKey = true, CanBeNull = false)] + public string PatientUsername { get; set; } + + [JsonIgnore] + [Association(ThisKey = nameof(PatientUsername), OtherKey = nameof(User.Username), CanBeNull = false)] + public User Usr { get; set; } + } +} diff --git a/SeniorAssistant/Models/Users/User.cs b/SeniorAssistant/Models/Users/User.cs index 422f837..16bdfea 100644 --- a/SeniorAssistant/Models/Users/User.cs +++ b/SeniorAssistant/Models/Users/User.cs @@ -20,6 +20,8 @@ namespace SeniorAssistant.Models public string LastName { get; set; } + public string Avatar { get; set; } + [JsonIgnore] [Association(ThisKey = nameof(Username), OtherKey = nameof(Doctor.Username), CanBeNull = true)] public Doctor Doc { get; set; } diff --git a/SeniorAssistant/SeniorAssistant.csproj b/SeniorAssistant/SeniorAssistant.csproj index 4259bee..89297d0 100644 --- a/SeniorAssistant/SeniorAssistant.csproj +++ b/SeniorAssistant/SeniorAssistant.csproj @@ -7,10 +7,6 @@ 7.1 - - - - diff --git a/SeniorAssistant/Startup.cs b/SeniorAssistant/Startup.cs index fece8f5..8ae6eaa 100644 --- a/SeniorAssistant/Startup.cs +++ b/SeniorAssistant/Startup.cs @@ -133,6 +133,8 @@ namespace SeniorAssistant db.CreateTableIfNotExists(); db.CreateTableIfNotExists(); db.CreateTableIfNotExists(); + db.CreateTableIfNotExists(); + db.CreateTableIfNotExists(); } } @@ -147,11 +149,11 @@ namespace SeniorAssistant List docs = db.Doctors.ToListAsync().Result; if (docs.Count == 0) { - users.Add(new User { Name = "Alfredo", LastName = "Parise", Email = "alfred.pary@libero.it", Username = "alfredigno", Password = "alfy" }); - users.Add(new User { Name = "Edoardo", LastName = "Marzio", Email = "edo.marzio@libero.it", Username = "marzietto", Password = "edo64" }); + users.Add(new User { Name = "Alfredo", LastName = "Parise", Email = "alfred.pary@libero.it", Username = "alfredigno", Password = "alfy", Avatar = "/uploads/default.jpg" }); + users.Add(new User { Name = "Edoardo", LastName = "Marzio", Email = "edo.marzio@libero.it", Username = "marzietto", Password = "edo64", Avatar = "/uploads/default.jpg" }); - docs.Add(new Doctor { Username = "alfredigno", Location = "Brasile" }); - docs.Add(new Doctor { Username = "marzietto", Location = "Uganda" }); + docs.Add(new Doctor { Username = "alfredigno", Location = "Brasile", PhoneNumber = "+0 123456789", Schedule = "Solo feriali 9:00-13:00/15:00-19:00" }); + docs.Add(new Doctor { Username = "marzietto", Location = "Uganda", PhoneNumber = "+9 87654321", Schedule = "Feriali e festivi 9:00-13:00" }); foreach (var doc in docs) db.InsertOrReplace(doc); @@ -167,7 +169,7 @@ namespace SeniorAssistant for (count=0; count +
+
+
+

Accesso tramite domanda di sicurezza

+
+
+
+

Se indovini la risposta allora verrai loggato. Li poi potrai modificare la password.

+
+

Domanda di sicurezza: @Model.Question

+ + + + +
+ +
+ +
+
+
+
+ diff --git a/SeniorAssistant/Views/Home/Index.cshtml b/SeniorAssistant/Views/Home/Index.cshtml deleted file mode 100644 index 5141726..0000000 --- a/SeniorAssistant/Views/Home/Index.cshtml +++ /dev/null @@ -1,36 +0,0 @@ - -@model object -@inject IHttpContextAccessor HttpContextAccessor - -@{ - ViewBag.Title = "Hello Razor"; - string session = HttpContextAccessor.HttpContext.Session.GetString("username"); -} - -
- @if (session == null) - { - @if (Model is string) - { -

Per poter accedere alla pagina [@Model] e' necessario essere loggati

- } - - - - - } - else - { - await Html.RenderPartialAsync("Profile", Model); // magari sostituire qui - } -
diff --git a/SeniorAssistant/Views/Home/Login.cshtml b/SeniorAssistant/Views/Home/Login.cshtml new file mode 100644 index 0000000..cec63c7 --- /dev/null +++ b/SeniorAssistant/Views/Home/Login.cshtml @@ -0,0 +1,95 @@ +@model string + +@if (Model != null) +{ + var m = Model; + if (Model.StartsWith("/")) + { + m = "Per poter accedere alla pagina[" + Model + "] e' necessario essere loggati"; + } +
+

@m

+} + +
+
+ +
+
+

Login

+
+ + +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + + + +
+ +
+ +
+
+ + diff --git a/SeniorAssistant/Views/Home/Message.cshtml b/SeniorAssistant/Views/Home/Message.cshtml index edeffa4..6dfa582 100644 --- a/SeniorAssistant/Views/Home/Message.cshtml +++ b/SeniorAssistant/Views/Home/Message.cshtml @@ -4,56 +4,102 @@ @using LinqToDB; @{ - ViewBag.Title = "Hello Razor"; - string username = HttpContextAccessor.HttpContext.Session.GetString("username"); + ViewBag.Title = "Chat"; + var session = HttpContextAccessor.HttpContext.Session; + var username = session.GetString("username"); var db = dbFactory.Create(); + var MaxMessages = 20; var messages = (from m in db.Messages where (m.Username.Equals(Model.Username) && m.Receiver.Equals(username)) ||(m.Receiver.Equals(Model.Username) && m.Username.Equals(username)) orderby m.Time ascending - select m).ToArray(); + select m).Take(MaxMessages).ToArray(); }
- @if (messages.Count() == 0) - { -

Non hai messaggi

- } - else - { -

Messaggi con @Model.Name @Model.LastName

- - foreach (var message in messages) - { - if (message.Seen == default && message.Receiver.Equals(username)) - { - message.Seen = DateTime.Now; - db.Update(message); - } -
- @if (message.Receiver.Equals(username)) - { -
-
- @message.Body -

@message.Seen

+
+
+
+
+

Messaggi con @Model.Name @Model.LastName

+
+
+ +
+ @if (messages.Count() == 0) + { +

Non hai messaggi

+ } + else + { + foreach (var message in messages) + { + if (message.Seen == default && message.Receiver.Equals(username)) + { + message.Seen = DateTime.Now; + db.Update(message); + } +
+ @if (message.Receiver.Equals(username)) + { + +
+
+
+ @Model.LastName + @message.Time +
+ + User image +
+ @message.Body +
+ +
+
+ } + else + { + +
+
+
+ Tu + @message.Time +
+ + User image +
+ @message.Body +
+
+
+ } +
+ } + }
- } - else - { -
-
@message.Body
-

@message.Seen

+
+ + +
- } - } -
- - -

+ +
+
+ +
+
+ } + } +
+
+ + + \ No newline at end of file diff --git a/SeniorAssistant/Views/Shared/Profile.cshtml.cs b/SeniorAssistant/Views/Home/Profile.cshtml.cs similarity index 100% rename from SeniorAssistant/Views/Shared/Profile.cshtml.cs rename to SeniorAssistant/Views/Home/Profile.cshtml.cs diff --git a/SeniorAssistant/Views/Home/Register.cshtml b/SeniorAssistant/Views/Home/Register.cshtml new file mode 100644 index 0000000..2587bb2 --- /dev/null +++ b/SeniorAssistant/Views/Home/Register.cshtml @@ -0,0 +1,137 @@ +
+
+ +
+
+

Registrazione

+
+ +
+
+
+ + +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+
+
+
+ + + \ No newline at end of file diff --git a/SeniorAssistant/Views/Shared/Register.cshtml.cs b/SeniorAssistant/Views/Home/Register.cshtml.cs similarity index 100% rename from SeniorAssistant/Views/Shared/Register.cshtml.cs rename to SeniorAssistant/Views/Home/Register.cshtml.cs diff --git a/SeniorAssistant/Views/Home/User.cshtml b/SeniorAssistant/Views/Home/User.cshtml index 752b93c..9f62bc9 100644 --- a/SeniorAssistant/Views/Home/User.cshtml +++ b/SeniorAssistant/Views/Home/User.cshtml @@ -3,9 +3,10 @@ @model User @{ - ViewBag.Title = "Hello Razor"; + ViewBag.Title = "Dati paziente"; var session = HttpContextAccessor.HttpContext.Session; var username = session.GetString("username"); + bool filter = HttpContextAccessor.HttpContext.Request.Query["from"] != (String)null; bool auth = username.Equals(Model.Username); bool isDoc = Model.IsPatient() && username.Equals(Model.Pat.Doctor); @@ -18,72 +19,154 @@ } else { -
- - -
+
+
+ + +
+
+ + +
+ +
+
+
+ + +
+
+
+ +
+ + + +
+ +
+
+
+ +
+
+ +
+ @if (isDoc) + { +
+ +

Se il valore del battito del paziente supera i valori che hai inserito verrai notificato

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

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

+ +
+ @if (isDoc) + { +
+
+ +
+
+ + + } +
+ +
- Invia un messaggio al tuo paziente -
-

Inserisci un minimo o massimo valore per il battito cardiaco

-

Se il valore del battito del paziente supera i valori che hai inserito verrai notificato

- - - - -
- - } +
+
} \ No newline at end of file diff --git a/SeniorAssistant/Views/Home/Users.cshtml b/SeniorAssistant/Views/Home/Users.cshtml index 27fec0e..5c25700 100644 --- a/SeniorAssistant/Views/Home/Users.cshtml +++ b/SeniorAssistant/Views/Home/Users.cshtml @@ -1,6 +1,6 @@ @model IEnumerable @{ - ViewBag.Title = "Hello Razor"; + ViewBag.Title = "Tutti gli utenti"; }
diff --git a/SeniorAssistant/Views/Shared/Breadcrumb.cshtml b/SeniorAssistant/Views/Shared/Breadcrumb.cshtml index a94e671..993075c 100644 --- a/SeniorAssistant/Views/Shared/Breadcrumb.cshtml +++ b/SeniorAssistant/Views/Shared/Breadcrumb.cshtml @@ -1,17 +1,17 @@ @{ - var controller = ViewContext.RouteData.Values["Controller"]; - var action = ViewContext.RouteData.Values["Action"]; + var controller = ViewContext.RouteData.Values["Controller"].ToString(); + var action = ViewContext.RouteData.Values["Action"].ToString(); } \ No newline at end of file diff --git a/SeniorAssistant/Views/Shared/Login.cshtml b/SeniorAssistant/Views/Shared/Login.cshtml deleted file mode 100644 index ec8c4d0..0000000 --- a/SeniorAssistant/Views/Shared/Login.cshtml +++ /dev/null @@ -1,36 +0,0 @@ -
    -
  • - - -
    - -
    - -
  • -
- - diff --git a/SeniorAssistant/Views/Shared/Logout.cshtml b/SeniorAssistant/Views/Shared/Logout.cshtml index 14f9a66..d03d286 100644 --- a/SeniorAssistant/Views/Shared/Logout.cshtml +++ b/SeniorAssistant/Views/Shared/Logout.cshtml @@ -7,14 +7,14 @@ - User Image + User Image