public ActionResult DeleteConfirmed(int?id) { bool delete = true; if (!id.HasValue) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Id is Request!")); } List <Doctor_IllPerson> doctorIllPerson = doctorIllPersonService.GetList(); foreach (var doctorıllperson in doctorIllPerson) { if (doctorıllperson.DoctorId == id) { delete = false; break; } } if (delete) { doctorService.Delete(id); TempData["Info"] = "Record successfully deleted to database"; } else { TempData["Info"] = "Doctor is not deleted from database"; } return(RedirectToAction("Index")); }
public async Task DeleteShouldReturnTrueAndProperCountOfDoctors() { var db = Tests.GetDatabase(); var doctorService = new DoctorService(db, null); var departmentService = new DepartmentService(db); await departmentService.CreateAsync("Cardiology", "Gosho", "SomeURL"); await db.SaveChangesAsync(); await doctorService.CreateAsync( "Gosho", "*****@*****.**", "SomeURL", "Cardiologist", "Cardiology"); await db.SaveChangesAsync(); var id = await db.Doctors .Where(d => d.Name == "Gosho") .Select(d => d.Id) .FirstOrDefaultAsync(); var deleted = await doctorService.Delete(id); await db.SaveChangesAsync(); deleted.Should() .BeTrue(); db.Doctors.Should() .HaveCount(1); }
public async Task DeleteTest() { var fakeRepository = Mock.Of <IDoctorRepository>(); var doctorService = new DoctorService(fakeRepository); var doctor = new Doctor() { Firstname = "Dias", Lastname = " Isabekov", Certificate = "IITU doctor" }; await doctorService.Delete(doctor); }
private void button6_Click(object sender, EventArgs e) { DoctorService doctorServices = new DoctorService(); Doctor temp = new Doctor(); temp.Phone = textBox1.Text; bool check = doctorServices.Delete(temp); if (check) { MessageBox.Show("Doctor Deleted"); } else { MessageBox.Show("Error Occured !"); } }
public void Delete(Doctor entity) => _doctorService.Delete(entity);
public bool Delete(Doctor obj) { return(_service.Delete(obj)); }
public void Delete(Doctor doctor) => service.Delete(doctor);