Exemplo n.º 1
0
        public bool ActualizarNutriologo(Nutriologo Nutriologo)
        {
            var Table = ReferenciaTabla("Nutriologo");

            TableOperation retrieveOperation = TableOperation.Retrieve <NutriologoEntity>(Nutriologo.Correo, Nutriologo.Nombre);

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

                NutriologoEntity editEntity = (NutriologoEntity)retrievedResult.Result;

                if (editEntity != null)
                {
                    editEntity.Pacientes = Nutriologo.Pacientes;
                    editEntity.Telefono  = Nutriologo.Telefono;
                    editEntity.Direccion = Nutriologo.Direccion;
                    editEntity.newNombre = Nutriologo.Nombre;
                    editEntity.newCorreo = Nutriologo.Correo;

                    TableOperation editOperation = TableOperation.Replace(editEntity);


                    // Execute the operation.
                    await Table.ExecuteAsync(editOperation);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        public Nutriologo LeerNutriologo(string correo, string nombre)
        {
            var            Table             = ReferenciaTabla("Nutriologo");
            Nutriologo     nutriologo        = new Nutriologo();
            TableOperation retrieveOperation = TableOperation.Retrieve <NutriologoEntity>(correo, nombre);

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

                var newNutriologo = (NutriologoEntity)retrievedResult.Result;

                var newNutrilogo2 = new Nutriologo(
                    newNutriologo.PartitionKey,
                    newNutriologo.RowKey,
                    newNutriologo.Pacientes,
                    newNutriologo.Direccion,
                    newNutriologo.Telefono);

                nutriologo = newNutrilogo2;
            }

            System.Threading.Thread.Sleep(500);
            return(nutriologo);
        }
Exemplo n.º 3
0
        public bool CrearNutriologo(Nutriologo model)
        {
            var StorageAccount = new CloudStorageAccount(new StorageCredentials(STORAGEACCOUNTNAME, ACCOUNTKEY), false);
            var tableClient    = StorageAccount.CreateCloudTableClient();
            var Table          = tableClient.GetTableReference("Nutriologo");

            Table.ExecuteAsync(TableOperation.Insert(new NutriologoEntity(model.Correo, model.Nombre, model.Telefono, model.Direccion)));

            return(true);
        }
Exemplo n.º 4
0
        public bool BorrarNutriologo(Nutriologo model)
        {
            var            Table             = ReferenciaTabla("Nutriologo");
            TableOperation retrieveOperation = TableOperation.Retrieve <NutriologoEntity>(model.Correo, model.Nombre);

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

                NutriologoEntity deleteEntity = (NutriologoEntity)retrievedResult.Result;

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

            System.Threading.Thread.Sleep(800);
            return(true);
        }