예제 #1
0
        public Response SavePatient([FromBody] PatientModel patientModel)
        {
            Response ans = null;

            try
            {
                if (ValidateSecurityAPI())
                {
                    if (patientModel.IsNotNull())
                    {
                        ans = PatientModel.SavePatient(patientModel);
                    }
                }
                else
                {
                    ans = new ResponsePatient()
                    {
                        IsSuccessful = false, ResponseMessage = AppManagement.MSG_API_Validation_Failure
                    };
                }
            }
            catch (Exception ex)
            {
                ans = new ResponsePatient()
                {
                    IsSuccessful = false, ResponseMessage = AppManagement.MSG_SaveTreatment_Duplicate
                };
            }

            return(ans);
        }
예제 #2
0
        public static bool AddPatient(string name, string address, DateTime dob)
        {
            // Surround this in a try/catch in case we can't write to the database.
            // Where you catch the exception, send the message back to the view to display in a text box.

            PatientModel patient = new PatientModel(0, name, dob, address);
            var          result  = patient.SavePatient();

            if (result)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }