예제 #1
0
        public async Task <IActionResult> Save([FromBody] Model.Appointment_History model)
        {
            try
            {
                var message = new Message();
                message.BusinessLogic = configuration.GetValue <string>("AppSettings:BusinessLogic:Appointment_History");
                message.Connection    = configuration.GetValue <string>("ConnectionStrings:appointmentControl");
                message.Operation     = Operation.Save;
                message.MessageInfo   = model.SerializeObject();
                using (var businessLgic = new DoWorkService())
                {
                    var result = await businessLgic.DoWork(message);

                    if (result.Status == Status.Failed)
                    {
                        return(BadRequest(result.Result));
                    }
                    var resultModel = result.DeSerializeObject <Model.Appointment_History>();
                    return(Ok(resultModel));
                }
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.Ambiguous, new { ex = ex, param = model }));
            }
        }
 public async Task Save(Model.Appointment_History model)
 {
     using (var connection = new SqlConnection(ConnectionString))
     {
         await connection.QueryAsync <
             appointmentControl.Backend.Model.Appointment_History>
             ("SP_APPOINTMENT_HISTORY_SAVE",
             param : new
         {
             P_PK_APPOINTMENT_HISTORY = model.Pk_Appointment_History,
             P_FK_MEDICAL_SERVICE     = model.Fk_Medical_Service,
             P_FK_PATIENT             = model.Fk_Patient,
             P_DATE   = model.Date,
             P_HOUR   = model.Hour,
             P_OPTION = model.Option
         },
             commandType : CommandType.StoredProcedure);
     }
 }