public async Task DeleteDoctor(DeleteDoctorCommand deleteDoctorCommand) { var doctorId = deleteDoctorCommand.DoctorId; var doctor = await FindDoctor(doctorId); _context.Doctors.Remove(doctor); await _context.SaveChangesAsync(); }
public void Should_Delete_A_Doctor() { DeleteDoctorCommand command = new DeleteDoctorCommand() { DoctorId = doctorRepository.doctors[0].Id }; Assert.IsNotNull(_handler.Handler(command)); }
public ICommandResult Handler(DeleteDoctorCommand command) { _doctorRepository.Delete(command.DoctorId); return(new DeleteDoctorCommandResult(command.DoctorId, true)); }