public void Edit(Physician _physicianEntry)
 {
     using (context = new DataFetchContext())
     {
         context.Physicians.Attach(_physicianEntry);
         context.Entry<Physician>(_physicianEntry).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void Create(Physician _physicianEntry)
 {
     using (context = new DataFetchContext())
     {
         _physicianEntry.ID = Guid.NewGuid();
         context.Physicians.Add(_physicianEntry);
         context.Entry<Physician>(_physicianEntry).State = System.Data.Entity.EntityState.Added;
         context.SaveChanges();
     }
 }
Example #3
0
 public ActionResult Edit(Physician _physicianEntry)
 {
     
     if (ModelState.IsValid)
     {
         physicianEditService = new PhysicianEditService();
         physicianEditService.Edit(_physicianEntry);
         return RedirectToAction("Index");
     }
     else
     {
         context = new DataFetchContext();
         ViewBag.HospitalRecord = context.Hospitals;
         ViewBag.SpecialtyRecord = context.Specialties;
         return View("Form", _physicianEntry);
        
     }
 }
Example #4
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);
         }
     }
 }