コード例 #1
0
        public async Task <bool> Actualizar(ProveedoresEntity actualizado)
        {
            var table = ObtenerTablaAzure();
            // Create a retrieve operation that expects a customer entity.
            TableOperation retrieveOperation = TableOperation.Retrieve <ProveedoresAzureEntity>(actualizado.RFC.Substring(0, 2), actualizado.RFC);

            // Execute the operation.
            TableResult retrievedResult = await table.ExecuteAsync(retrieveOperation);

            // Assign the result to a CustomerEntity.
            var updateEntity = retrievedResult.Result as ProveedoresAzureEntity;

            // Create the Delete TableOperation.
            if (updateEntity != null)
            {
                updateEntity.nombre    = actualizado.nombre;
                updateEntity.apellidoP = actualizado.apellidoP;
                updateEntity.apellidoM = actualizado.apellidoM;
                updateEntity.telefono  = actualizado.telefono;

                TableOperation updateOperation = TableOperation.Replace(updateEntity);

                // Execute the operation.
                await table.ExecuteAsync(updateOperation);

                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public async Task <bool> Guardar(ProveedoresEntity nuevo)
        {
            var table = ObtenerTablaAzure();

            var azE = new ProveedoresAzureEntity(nuevo.nombre, nuevo.RFC);

            azE.apellidoP = nuevo.apellidoP;
            azE.apellidoM = nuevo.apellidoM;
            azE.telefono  = nuevo.telefono;

            var insertOperation = TableOperation.Insert(azE);

            await table.ExecuteAsync(insertOperation);

            return(true);
        }