Example #1
0
 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 }));
     }
 }
Example #2
0
 public ActionResult CreatePatient(Patient patient)
 {
     try
     {
         _context.Patient.Add(patient);
         _context.SaveChanges();
         return(StatusCode(204));
     }
     catch (Exception e)
     {
         return(StatusCode(400, new { message = e }));
     }
 }
Example #3
0
        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 }));
            }
        }