Пример #1
0
 public PartialViewResult Create(Admission admission)
 {
     try
     {
         if (ModelState.IsValid)
         {
             int patientId = admission.PatientId;
             admission.ParseDateTime();
             ctx.Admissions.Add(admission);
             ctx.SaveChanges();
             return(Index(patientId));
         }
         else
         {
             return(Create(admission.PatientId));
         }
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine("Error creating an admission: " + e.GetBaseException().ToString());
     }
     return(null);
 }
Пример #2
0
 public PartialViewResult Edit(Admission admission)
 {
     try
     {
         if (ModelState.IsValid)
         {
             int patientId = admission.PatientId;
             patientId = admission.PatientId;
             admission.ParseDateTime();
             ctx.Entry(admission).State = EntityState.Modified;
             ctx.SaveChanges();
             return(Index(patientId));
         }
         else
         {
             return(Edit(admission.Id));
         }
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine("Error editing an admission: " + e.GetBaseException().ToString());
     }
     return(null);
 }