public async Task <bool> ActualizarReferencia(string id, string nuevoEstado, string referencia) { PedidoModel pedido = await LeerPedido(id); var table = TablaAzure(); var retriveOP = TableOperation .Retrieve <PedidoAzEntity>( PedidoAzEntity.PartitionFromRowId(pedido.PedidoId), pedido.PedidoId ); var resultado = await table.ExecuteAsync(retriveOP); if (resultado != null) { var p = resultado.Result as PedidoAzEntity; p.Estado = nuevoEstado; p.Referencia = referencia; var upOp = TableOperation.Replace(p); await table.ExecuteAsync(upOp); return(true); } else { return(false); } }
public async Task <string> IniciarPedido(PedidoModel nuevoPedido) { var table = TablaAzure(); // Create the table if it doesn't exist. var creada = await table.CreateIfNotExistsAsync(); var azEn = new PedidoAzEntity(nuevoPedido.FechaPedido, nuevoPedido.CorreoElectronico); //azEn.PedidoId=nuevoPedido.PedidoId; azEn.Cliente = nuevoPedido.Cliente; azEn.Productos = nuevoPedido.Productos; azEn.FechaPedido = nuevoPedido.FechaPedido; azEn.Estado = "No Pagado"; azEn.Referencia = "Vacio"; azEn.CorreoElectronico = nuevoPedido.CorreoElectronico; // Create the TableOperation object that inserts the customer entity. TableOperation insertOperation = TableOperation.Insert(azEn); // Execute the insert operation. var x = await table.ExecuteAsync(insertOperation); return(azEn.RowKey); }
public async Task <bool> CompletarPedido(PedidoModel pedido) { return(await AvanzarPedido(pedido, "Completado")); }
public async Task <bool> CancelarPedido(PedidoModel pedido) { return(await AvanzarPedido(pedido, "Cancelado")); }
public async Task <bool> Actualizar(string id, string nuevoEstado) { PedidoModel pedido = await LeerPedido(id); return(await AvanzarPedido(pedido, nuevoEstado)); }