public ActionResult EditDetails(PhysicianDataModel dt) { CASDatabaseEntities db = new CASDatabaseEntities(); Physician objPhysician = new Physician(); List <SelectListItem> list = new List <SelectListItem>(); var getSpecData = db.SpecializationDatas.ToList(); foreach (var item in getSpecData) { list.Add(new SelectListItem { Text = item.SpecializationName, Value = item.SpecializationID.ToString() }); } dt.ListSpecialization = list; var id = Convert.ToInt32(Session["UserID"]); var getData = db.Physicians.Where(a => a.UserID == id).FirstOrDefault(); if (ModelState.IsValid) { if (getData != null) { getData.FirstName = dt.FirstName; getData.LastName = dt.LastName; getData.Gender = dt.Gender; getData.SpecializationID = dt.SpecializationID; getData.TotalExperience = dt.TotalExperience; getData.Education = dt.Education; getData.CurrentStatus = dt.CurrentStatus; } else { objPhysician.FirstName = dt.FirstName; objPhysician.LastName = dt.LastName; objPhysician.Gender = dt.Gender; objPhysician.TotalExperience = dt.TotalExperience; objPhysician.SpecializationID = dt.SpecializationID; objPhysician.Education = dt.Education; objPhysician.CurrentStatus = dt.CurrentStatus; db.Physicians.Add(objPhysician); } db.SaveChanges(); } var checkName = db.Physicians.Where(a => a.UserID == id).FirstOrDefault(); if (checkName.FirstName != null) { Session["Name"] = checkName.FirstName; } else { Session["Name"] = null; } Session["ID"] = checkName.PhysicianID; return(View(dt)); }
public ActionResult ViewPhysician() { CASDatabaseEntities db = new CASDatabaseEntities(); List <PhysicianDataModel> list = new List <PhysicianDataModel>(); PhysicianDataModel dt = new PhysicianDataModel(); var getData = from p in db.Physicians join s in db.SpecializationDatas on p.SpecializationID equals s.SpecializationID join u in db.Users on p.UserID equals u.UserID where p.FirstName != null select new { p.PhysicianID, p.FirstName, p.LastName, p.Gender, p.TotalExperience, p.Education, p.CurrentStatus, s.SpecializationName, u.EmailID }; foreach (var item in getData) { list.Add(new PhysicianDataModel { PhysicianID = item.PhysicianID, FirstName = item.FirstName, LastName = item.LastName, Gender = item.Gender, TotalExperience = item.TotalExperience, Education = item.Education, CurrentStatus = item.CurrentStatus, SpecializationName = item.SpecializationName, EmailID = item.EmailID, }); } dt.ListPhysician = list; return(View(dt)); }
public ActionResult EditDetails() { CASDatabaseEntities db = new CASDatabaseEntities(); PhysicianDataModel dt = new PhysicianDataModel(); var id = Convert.ToInt32(Session["UserID"]); var getData = db.Physicians.Where(a => a.UserID == id).FirstOrDefault(); if (getData != null) { dt.FirstName = getData.FirstName; dt.LastName = getData.LastName; dt.Gender = getData.Gender; dt.SpecializationID = getData.SpecializationID; dt.TotalExperience = getData.TotalExperience; dt.Education = getData.Education; dt.CurrentStatus = getData.CurrentStatus; } else { dt.FirstName = null; } List <SelectListItem> list = new List <SelectListItem>(); var getSpecData = db.SpecializationDatas.ToList(); foreach (var item in getSpecData) { list.Add(new SelectListItem { Text = item.SpecializationName, Value = item.SpecializationID.ToString() }); } dt.ListSpecialization = list; return(View(dt)); }
public ActionResult Physician() { CASDatabaseEntities db = new CASDatabaseEntities(); List <PhysicianDataModel> list = new List <PhysicianDataModel>(); PhysicianDataModel dt = new PhysicianDataModel(); var getDetails = (from p in db.Physicians join s in db.SpecializationDatas on p.SpecializationID equals s.SpecializationID select new { p.FirstName, p.LastName, p.Gender, p.TotalExperience, p.Education, p.CurrentStatus, s.SpecializationName }).OrderBy(m => m.SpecializationName); foreach (var item in getDetails) { list.Add(new PhysicianDataModel { FirstName = item.FirstName, LastName = item.LastName, Gender = item.Gender, TotalExperience = item.TotalExperience, Education = item.Education, CurrentStatus = item.CurrentStatus, SpecializationName = item.SpecializationName }); } dt.ListPhysician = list; return(View(dt)); }