public IActionResult OnGet(int?id, int patientId) { if (id.HasValue) { Diagnosis = diagnosisService.GetDiagnosisById(id.Value); Patient = patientService.GetPatientById(patientId); if (Diagnosis == null) { return(RedirectToPage("NotFound")); } Viruses = virusService.GetViruses(); foreach (var item in Viruses) { foreach (var vd in Diagnosis.DiagnosisViruses) { if (item.Id == vd.VirusId) { item.IsSelected = true; } } } // Pri edit na diagnoza Virusite koi vekje gi ima pacientot da bida stiklirani } else { Diagnosis = new Diagnosis(); Patient = patientService.GetPatientById(patientId); if (Patient.Diagnosis.Any(d => d.Death == true)) { TempData["Message"] = "Can not Create new Diagnose because Patient is Dead!"; return(RedirectToPage("DiagnosisList", new { id = Patient.Id })); } } Viruses = virusService.GetViruses(); return(Page()); }
public HttpResponseMessage Show(long id) { HttpResponseMessage response = null; try { Diagnosis mDiagnosis = diagnosisService.GetDiagnosisById(id); if (mDiagnosis == null) { response = Request.CreateResponse(HttpStatusCode.NotFound, "Requested entity was not found in database."); } else { response = Request.CreateResponse(HttpStatusCode.OK, mDiagnosis); } } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }