コード例 #1
0
        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"));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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 !");
            }
        }
コード例 #5
0
 public void Delete(Doctor entity)
 => _doctorService.Delete(entity);
コード例 #6
0
 public bool Delete(Doctor obj)
 {
     return(_service.Delete(obj));
 }
コード例 #7
0
 public void Delete(Doctor doctor) => service.Delete(doctor);