public void SaveAppointmentDetails(AppointmentDetails appointmentDetails)
 {
     hospitalEntities.Appointments.Add(new Appointment {
         DoctorId    = appointmentDetails.DoctorId,
         PatientId   = appointmentDetails.PatientId,
         Problem     = appointmentDetails.Problem,
         CreatedDate = DateTime.Now
     });
     hospitalEntities.SaveChanges();
 }
        public ActionResult Create([Bind(Include = "ContactId,ContactName,Designation,EmailId,PhoneNo1,PhoneNo2,Address")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                db.Contacts.Add(contact);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contact));
        }
Example #3
0
        public ActionResult Create([Bind(Include = "MId,MedicineName,Formula,DisseaseId,Comment,CreatedBy,CreationDate,UpdatedBy,Updationdate")] Medicine medicine)
        {
            if (ModelState.IsValid)
            {
                db.Medicines.Add(medicine);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(medicine));
        }
Example #4
0
        public ActionResult DeleteDoctorbyId(Doctor doctor)
        {
            Doctor deleteDoctorById = db.Doctors.Find(doctor.DoctorId);

            db.Doctors.Remove(deleteDoctorById);
            db.SaveChanges();
            return(RedirectToAction("GetDoctor"));
        }
 public ActionResult EditDisseaseDetail(Diseass obj)
 {
     //  db.sp_Update_Dissease_ById(obj.DiseasesId,obj.DisseaseName, obj.Description, obj.CreatedBy, Convert.ToInt32(Session["UserId"]));
     //Diseass dobj = db.Diseasses.Find(obj.DiseasesId);
     //dobj.DisseaseName=
     obj.UpdatedBy = 1;
     db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
   
     int Result = db.SaveChanges();
     if (Result > 0)
     {
         return RedirectToAction("GetDisseaseDetails");
     }
     else
     {
         ViewBag.Message = "Record Failed To Update";
         return View(obj);
     }
 }
Example #6
0
 public void AddUpdateStaff(StaffDetails user)
 {
     try
     {
         Staff staff         = user.MapUserToStaff();
         var   existingStaff = hospitalEntities.Staffs.FirstOrDefault(s => s.StaffKey == user.StaffKey);
         if (existingStaff != null)
         {
             existingStaff = staff;
         }
         else
         {
             hospitalEntities.Staffs.Add(staff);
         }
         hospitalEntities.SaveChanges();
     }
     catch (Exception ex)
     {
     }
 }
Example #7
0
        public int SavePatientDetails(PatientDetails patientDetails)
        {
            Patient patient = patientDetails.MapPatientDetails();

            try
            {
                var existingPatient = hospitalEntities.Patients.FirstOrDefault(s => s.PatientKey == patient.PatientKey);
                if (existingPatient != null)
                {
                    existingPatient = patient;
                }
                else
                {
                    hospitalEntities.Patients.Add(patient);
                }
                hospitalEntities.SaveChanges();
                return(patient.PatientKey);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }