public void AddDoctor(AddOrUpdateDoctorRequest req) { var addedDoctor = _context.Add(new Doctor { FirstName = req.FirstName, LastName = req.LastName, Email = req.Email }); _context.SaveChanges(); }
public void UpdateDoctor(AddOrUpdateDoctorRequest req, int id) { var doctor = _context.Doctor.Find(id); if (doctor == null) { return; } _context.Entry(doctor).CurrentValues.SetValues(req); _context.SaveChanges(); }
public IActionResult UpdateDoctor(AddOrUpdateDoctorRequest req, int id) { _service.UpdateDoctor(req, id); return(Ok()); }
public IActionResult AddDoctor(AddOrUpdateDoctorRequest req) { _service.AddDoctor(req); return(Ok()); }