コード例 #1
0
ファイル: EfDoctorDbService.cs プロジェクト: Blizu/APBD11
        public void DeleteDoctor(int doctorId)
        {
            var doctor = _context.Doctors.Find(doctorId);

            _context.Remove(doctor);

            _context.SaveChanges();
        }
コード例 #2
0
ファイル: DoctorController.cs プロジェクト: s16061/APBDcw11
        public IActionResult DeleteDoctor(int id)
        {
            var res = new Doctor
            {
                IdDoctor = id
            };

            _context.Attach(res);
            _context.Remove(res);
            _context.SaveChangesAsync();
            return(Ok("Deleted"));
        }
コード例 #3
0
 public bool RemoveDoctor(Doctor doc)
 {
     _dbService.Remove(doc);
     try
     {
         _dbService.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
コード例 #4
0
        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 :(");
            }
        }
コード例 #5
0
        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));
        }
コード例 #6
0
 public void RemoveDoctor(Doctor doctor)
 {
     _db.Remove(doctor);
     _db.SaveChanges();
 }