示例#1
0
        public IActionResult DeleteDoctor(int id)
        {
            Doctor doctor = context.Doctors.Find(id);

            if (doctor != null)
            {
                context.Remove <Doctor>(doctor);
                context.SaveChanges();
                return(Ok($"Doctor removed"));
            }
            return(NotFound("No such doctor"));
        }
示例#2
0
        public IActionResult deleteDoctor(int id)
        {
            Doctor doctor = context.Doctors.Find(id);

            if (doctor != null)
            {
                context.Remove <Doctor>(doctor);
                context.SaveChanges();
                return(Ok($"doktorek o {id} usuniety"));
            }
            return(NotFound("nie ma takiego doktorka"));
        }
示例#3
0
        public string DeleteDoctor(int id)
        {
            var doctor = _hospitalContext.Doctors.FirstOrDefault(d => d.IdDoctor == id);

            if (doctor != null)
            {
                _hospitalContext.Remove(doctor);
                _hospitalContext.SaveChanges();
                return("Doctor deleted");
            }
            else
            {
                return("Doctor not found");
            }
        }
        public IActionResult Delete(int id)
        {
            var hospital = dbContext.Hospitals.FirstOrDefault(h => h.Id == id);

            if (hospital != null)
            {
                dbContext.Remove(hospital);
                dbContext.SaveChanges();

                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
示例#5
0
 public bool DeletePatient(int id)
 {
     try
     {
         using (var context = new HospitalContext())
         {
             PatientContext patientContext = context.PatientContexts.Find(id);
             context.Remove(patientContext);
             context.SaveChanges();
         }
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#6
0
 public bool DeleteDoctor(int id)
 {
     try
     {
         using (var context = new HospitalContext())
         {
             DoctorContext doctorContext = context.DoctorContexts.Find(id);
             context.Remove(doctorContext);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }