private void MapearDtgFactura(DataGridView dtg) { dtg.Rows.Clear(); facturaService = new FacturaService(ConfigConnection.ConnectionString); foreach (var item in facturaService.ConsultarFacturas()) { int n = dtg.Rows.Add(); dtg.Rows[n].Cells[0].Value = item.Numero; dtg.Rows[n].Cells[1].Value = item.Lugar.Ciudad; dtg.Rows[n].Cells[2].Value = item.Cantidad; dtg.Rows[n].Cells[3].Value = item.Iva; dtg.Rows[n].Cells[4].Value = item.SubTotal; dtg.Rows[n].Cells[5].Value = item.Total; dtg.Rows[n].Cells[6].Value = item.Cliente.Cedula; dtg.Rows[n].Cells[7].Value = item.Cliente.PrimerNombre; dtg.Rows[n].Cells[8].Value = item.Cliente.Telefono; dtg.Rows[n].Cells[9].Value = item.Fecha; dtg.Rows[n].Cells[10].Value = item.Estado; } TxtTotal.Text = facturaService.ConsultarFacturas().Count.ToString(); }
public ActionResult <FacturaViewModel> ConsultarFacturas( ) { var Response = _service.ConsultarFacturas(); if (Response.Error) { ModelState.AddModelError("Error al consultar a las facturas", Response.Mensaje); var detalleProblemas = new ValidationProblemDetails(ModelState); detalleProblemas.Status = StatusCodes.Status500InternalServerError; return(BadRequest(detalleProblemas)); } return(Ok(Response.Facturas)); }