Exemplo n.º 1
0
/*
 *      public async void BorrarPaciente(string PK, string RK){
 *          var Table = ReferenciaTabla("Pacientes");
 *
 *          TableOperation retrieveOperation = TableOperation.Retrieve<PacienteEntity>(PK, RK);
 *          TableResult retrievedResult = await Table.ExecuteAsync(retrieveOperation);
 *          PacienteEntity deleteEntity = (PacienteEntity)retrievedResult.Result;
 *
 *          if (deleteEntity != null)
 *          {
 *              TableOperation deleteOperation = TableOperation.Delete(deleteEntity);
 *
 *              await Table.ExecuteAsync(deleteOperation);
 *          }
 *      }
 */

        public bool ActualizarPaciente(Paciente Paci)
        {
            var Table = ReferenciaTabla("Pacientes");

            TableOperation retrieveOperation = TableOperation.Retrieve <PacienteEntity>(Paci.NombreNut, Paci.NombrePac);

            EditarNutriologo();
            async void EditarNutriologo()
            {
                TableResult retrievedResult = await Table.ExecuteAsync(retrieveOperation);

                PacienteEntity editEntity = (PacienteEntity)retrievedResult.Result;

                if (editEntity != null)
                {
                    editEntity.Edad   = Paci.Edad;
                    editEntity.Altura = Paci.Altura;
                    editEntity.Peso   = Paci.Peso;

                    TableOperation editOperation = TableOperation.Replace(editEntity);

                    await Table.ExecuteAsync(editOperation);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        public bool BorrarPaciente(Paciente Paci)
        {
            var            Table             = ReferenciaTabla("Pacientes");
            TableOperation retrieveOperation = TableOperation.Retrieve <PacienteEntity>(Paci.NombreNut, Paci.NombrePac);

            EliminarPaciente();
            async void EliminarPaciente()
            {
                TableResult retrievedResult = await Table.ExecuteAsync(retrieveOperation);

                PacienteEntity deleteEntity = (PacienteEntity)retrievedResult.Result;

                if (deleteEntity != null)
                {
                    TableOperation deleteOperation = TableOperation.Delete(deleteEntity);
                    await Table.ExecuteAsync(deleteOperation);
                }
            }

            return(true);
        }