public async Task <IActionResult> Edit(int id, [Bind("IdReciboPago,IdPedido")] ReciboPago reciboPago) { if (id != reciboPago.IdReciboPago) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(reciboPago); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReciboPagoExists(reciboPago.IdReciboPago)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdPedido"] = new SelectList(_context.Pedido, "IdPedido", "IdPedido", reciboPago.IdPedido); return(View(reciboPago)); }
public async Task <IActionResult> Create([Bind("IdReciboPago,IdPedido")] ReciboPago reciboPago) { if (ModelState.IsValid) { _context.Add(reciboPago); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdPedido"] = new SelectList(_context.Pedido, "IdPedido", "IdPedido", reciboPago.IdPedido); return(View(reciboPago)); }
public string Post(ReciboPago ReciboPago) { try { //Las variables de fecha, son igualadas a un valor Datatime DateTime time = ReciboPago.FechaExpedicion; DateTime time2 = ReciboPago.FechaPago; //Al momento de insertar los valores de las fechas, estan seran insertadas con el formato 'Format' string format = "yyyy-MM-dd HH:mm:ss"; //De esta manera no causara error al tratar de insertar fechas en la base de datos SQL DataTable table = new DataTable(); string query = @" Execute itInsertNuevoReciboPago2 " + ReciboPago.IdCliente + " , '" + time.ToLocalTime().ToString(format) + "' , '" + time2.ToLocalTime().ToString(format) + "' , '" + ReciboPago.FormaPago + "' , '" + ReciboPago.Moneda + "' , '" + ReciboPago.TipoCambio + "' , '" + ReciboPago.Cantidad + "' , '" + ReciboPago.Referencia + "' , '" + ReciboPago.UUID + "' , '" + ReciboPago.Tipo + "' , '" + ReciboPago.Certificado + "' , '" + ReciboPago.NoCertificado + "' , '" + ReciboPago.Cuenta + "' , '" + ReciboPago.CadenaOriginal + "' , '" + ReciboPago.SelloDigitalSAT + "' , '" + ReciboPago.SelloDigitalCFDI + "' , '" + ReciboPago.NoSelloSAT + "' , '" + ReciboPago.RFCPAC + "' , '" + ReciboPago.Estatus + "','" + ReciboPago.folio + "'"; using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString)) using (var cmd = new SqlCommand(query, con)) using (var da = new SqlDataAdapter(cmd)) { cmd.CommandType = CommandType.Text; da.Fill(table); } return("Recibo de Pago Agregado"); } catch (Exception exe) { return("Se produjo un error" + exe); } }