public async Task <IActionResult> PutCliente(string id, Cliente cliente) { if (id != cliente.Cedula) { return(BadRequest()); } _context.Entry(cliente).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutDetallePago(int id, DetallePago detallePago) { if (id != detallePago.IdTarjeta) { return(BadRequest()); } _context.Entry(detallePago).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DetallePagoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTarjetaCredito(int id, TarjetaCredito tarjetaCredito) { if (id != tarjetaCredito.id) { return(BadRequest()); } _context.Entry(tarjetaCredito).State = EntityState.Modified; try { if (string.IsNullOrEmpty(tarjetaCredito.ClienteCedula)) { tarjetaCredito.ClienteCedula = null; } await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TarjetaCreditoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "Id,FlightNumber")] Transport transport) { if (ModelState.IsValid) { db.Entry(transport).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(transport)); }
public ActionResult Edit([Bind(Include = "Id,DepartureStation,ArrivalStation,DepartureDate,TransportId,Price,Currency")] Flight flight) { if (ModelState.IsValid) { db.Entry(flight).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TransportId = new SelectList(db.Transports, "Id", "FlightNumber", flight.TransportId); return(View(flight)); }
public Person Edit([FromQuery] string name, string type, string phone, string date, int id) { using (AplicationDBContext db = new AplicationDBContext()) { var person = db.Persons.Include(x => x.Descriptions).Include(x => x.Reservations).Where(x => x.Id == id).FirstOrDefault(); person.Name = name; person.Phone = phone; string format = "MM/dd/yyyy"; DateTime b = DateTime.ParseExact(date, format, CultureInfo.InvariantCulture); person.BirthDate = b; person.Descriptions.ElementAt(0).Type = type; db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return(person); } }
public ActionResult Put(int id, [FromBody] Roles roles) { try { if (id != roles.Id) { return(BadRequest()); } _context.Entry(roles).State = EntityState.Modified; _context.Update(roles); _context.SaveChanges(); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult Put(int id, [FromBody] TipoPlanillas tp) { try { if (id != tp.Id) { return(BadRequest()); } _context.Entry(tp).State = EntityState.Modified; _context.Update(tp); _context.SaveChanges(); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult Put(int id, [FromBody] Historial history) { try { if (id != history.Id) { return(BadRequest()); } _context.Entry(history).State = EntityState.Modified; _context.Update(history); _context.SaveChanges(); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }