public IActionResult LabPatient(LabMainVM obj) { int Follow_up_Id = (int)HttpContext.Session.GetInt32("Follow_up_Id"); int patient_id = (int)_auc.Follow_Ups.Where(d => d.Id == Follow_up_Id) .Select(d => d.Patient_Id) .Single(); int Doctor_Reg_Id = (int)HttpContext.Session.GetInt32("User_Reg_Id"); int Doctor_Id = _auc.Staff .Where(d => d.Registration_Id == Doctor_Reg_Id) .Select(d => d.Id) .Single(); //TempData["p_id"] = patient_id; Patient patient; Follow_Up follow_Up; follow_Up = _auc.Follow_Ups.Where(d => d.Id == Follow_up_Id).FirstOrDefault(); patient = _auc.Patients.Where(i => i.Id == patient_id).FirstOrDefault(); if (obj.Status != "Pending") { follow_Up.Status = obj.Status; } _auc.SaveChanges(); ModelState.Clear(); var result = _auc.Patients .Where(O => O.Id == patient_id) .Select(I => new Patient { Name = I.Name, Phone = I.Phone }) .ToList(); var regestration_id = _auc.Patients.Include(o => o.Registration) .Where(O => O.Id == patient_id) .ToList(); var mail = regestration_id[0].Registration.Email; var status = _auc.Follow_Ups .Where(d => d.Id == Follow_up_Id) .Select(d => d.Status) .Single(); //var status ViewBag.data1 = result; ViewBag.data3 = mail; ViewBag.status = status; return(View()); }
public IActionResult LabMain(LabMainVM m, string sort, string search) { if (m.P_Id != 0) { HttpContext.Session.SetInt32("Follow_up_Id", m.P_Id); return(Redirect("/Lab/LabPatient")); } if (!string.IsNullOrEmpty(search)) { TempData["SearchItem"] = m.Search_Item; } if (!string.IsNullOrEmpty(sort)) { TempData["SortItem"] = m.Sort_Item; TempData["OrderItem"] = m.Order_Item; } return(Redirect("/Lab/LabMain")); }