public void DeleteDoctor(int doctorId) { var doctor = _context.Doctors.Find(doctorId); _context.Remove(doctor); _context.SaveChanges(); }
public IActionResult DeleteDoctor(int id) { var res = new Doctor { IdDoctor = id }; _context.Attach(res); _context.Remove(res); _context.SaveChangesAsync(); return(Ok("Deleted")); }
public bool RemoveDoctor(Doctor doc) { _dbService.Remove(doc); try { _dbService.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public string DeleteDoctor(int id) { var doctor = context.Doctors.FirstOrDefault(d => d.IdDoctor == id); if (doctor != null) { context.Remove(doctor); context.SaveChanges(); return("Doctor successfully deleted"); } else { return("Doctor not found :("); } }
public IActionResult DeleteDoctor(int id) { var db = new DoctorDbContext(); var d1 = new Doctor() { IdDoctor = id }; db.Attach(d1); db.Remove(d1); db.SaveChanges(); return(Ok(d1)); }
public void RemoveDoctor(Doctor doctor) { _db.Remove(doctor); _db.SaveChanges(); }