Beispiel #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);
        }
Beispiel #2
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);
        }