Ejemplo n.º 1
0
 public ActionResult Create()
 {
     DataFetchContext dataFetchContext = new DataFetchContext();
     ViewBag.HospitalRecord = dataFetchContext.Hospitals;
     ViewBag.SpecialtyRecord = dataFetchContext.Specialties;
     return View("Form",new Physician());
 }
Ejemplo n.º 2
0
 public ActionResult Edit(Guid id)
 {
     DataFetchContext dataFetchContext = new DataFetchContext();
     var toEditRecord = dataFetchContext.Physicians.Single(x => x.ID == id);
     ViewBag.HospitalRecord = dataFetchContext.Hospitals;
     ViewBag.SpecialtyRecord = dataFetchContext.Specialties;
     return View("Form", toEditRecord);
 }
Ejemplo n.º 3
0
 public ActionResult Edit(Physician a)
 {
     using (var context = new DataFetchContext())
     {
         if(ModelState.IsValid)
         {
             context.Physicians.Attach(a);
             context.Entry<Physician>(a).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return RedirectToAction("Index");
         }
         else
         {
             DataFetchContext dataFetchContext = new DataFetchContext();
             ViewBag.HospitalRecord = dataFetchContext.Hospitals;
             ViewBag.SpecialtyRecord = dataFetchContext.Specialties;
             return View("Form", a);
         }
     }
 }