public bool BorrarIngrediente(Ingrediente Paci) { var Table = ReferenciaTabla("Ingredientes"); TableOperation retrieveOperation = TableOperation.Retrieve <IngredienteEntity>(Paci.Nombre, Paci.OtraCosa); EliminarIngrediente(); async void EliminarIngrediente() { TableResult retrievedResult = await Table.ExecuteAsync(retrieveOperation); IngredienteEntity deleteEntity = (IngredienteEntity)retrievedResult.Result; if (deleteEntity != null) { TableOperation deleteOperation = TableOperation.Delete(deleteEntity); await Table.ExecuteAsync(deleteOperation); } } return(true); }
/* * public async void BorrarIngrediente(string PK, string RK){ * var Table = ReferenciaTabla("Ingredientes"); * * TableOperation retrieveOperation = TableOperation.Retrieve<IngredienteEntity>(PK, RK); * TableResult retrievedResult = await Table.ExecuteAsync(retrieveOperation); * IngredienteEntity deleteEntity = (IngredienteEntity)retrievedResult.Result; * * if (deleteEntity != null) * { * TableOperation deleteOperation = TableOperation.Delete(deleteEntity); * * await Table.ExecuteAsync(deleteOperation); * } * } */ public bool ActualizarIngrediente(Ingrediente Paci) { var Table = ReferenciaTabla("Ingredientes"); TableOperation retrieveOperation = TableOperation.Retrieve <IngredienteEntity>(Paci.Nombre, Paci.OtraCosa); EditarNutriologo(); async void EditarNutriologo() { TableResult retrievedResult = await Table.ExecuteAsync(retrieveOperation); IngredienteEntity editEntity = (IngredienteEntity)retrievedResult.Result; if (editEntity != null) { TableOperation editOperation = TableOperation.Replace(editEntity); await Table.ExecuteAsync(editOperation); } } return(true); }