public ActionResult CreatePhysician(Physician physician) { try { _context.Physician.Add(physician); _context.SaveChanges(); return(StatusCode(204)); } catch (Exception e) { return(StatusCode(400, new { message = e.Message })); } }
public ActionResult CreatePatient(Patient patient) { try { _context.Patient.Add(patient); _context.SaveChanges(); return(StatusCode(204)); } catch (Exception e) { return(StatusCode(400, new { message = e })); } }
public ActionResult CreateAppointment(Appointment appointment) { Random random = new Random(); int appointmentId = random.Next(210, 1000); try { appointment.AppointmentId = appointmentId; _context.Appointment.Add(appointment); _context.SaveChanges(); return(StatusCode(204)); } catch (Exception e) { return(StatusCode(400, new { message = e })); } }