Esempio n. 1
0
        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());
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
 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));
 }
Esempio n. 5
0
 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));
 }
Esempio n. 6
0
 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));
     }
 }
Esempio n. 8
0
 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));
     }
 }
Esempio n. 9
0
 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));
     }
 }