예제 #1
0
 public async Task <Reserva> Post(Reserva reserva)
 {
     if (reserva.Id == 0)
     {
         return(await _reservaService.Create(reserva));
     }
     else
     {
         return(await _reservaService.Update(reserva));
     }
 }
예제 #2
0
        public ActionResult Create([Bind(Include = "Id_reserva,Id_vuelo,Asientos,Id_cliente")] Reserva reserva)
        {
            if (ModelState.IsValid)
            {
                _reservaService.Create(reserva);
                return(RedirectToAction("Index"));
            }
            var clientes = _clienteService.GetAll();

            ViewBag.Id_cliente = new SelectList(clientes, "Id_cliente", "Nombre", reserva.Id_cliente);
            ViewBag.Id_vuelo   = new SelectList(db.Vueloes, "Id_vuelo", "Id_vuelo", reserva.Id_vuelo);
            return(View(reserva));
        }