Esempio n. 1
0
        ////////////////////////////////////////////////////////////// detail du reservation//////////////
        // GET: Home/Details/5
        public ActionResult DetailsReservation(int id)

        {
            int x;

            reservationvole u = reservationService.GetReservationById(id);

            if (u.vole_id.HasValue)
            {
                x      = u.vole_id.Value;
                u.vole = voleservice.GetVoleById(x);
            }

            ReservationVolModels lum = new ReservationVolModels

            {
                id = u.id,
                date_reservation = u.date_reservation,
                vole             = u.vole
            };


            if (lum == null)
            {
                return(HttpNotFound());
            }

            return(View(lum));
        }
        public void DeleteReservation(int id)
        {
            reservationvole p = uow.getRepository <reservationvole>().GetById(id);

            uow.getRepository <reservationvole>().Delete(p);
            uow.Commit();
        }
        public ActionResult ReserverVole(int id)
        {
            reservationvole res = new reservationvole();

            res.vole_id          = id;
            res.users_id         = currentUser.id;
            res.date_reservation = DateTime.Now;
            reservationService.AddReservation(res);
            reservationService.SaveChange();


            IEnumerable <vole> vols = voleservice.GetAllVolsFromNow();

            return(RedirectToAction("Search", vols));
        }
Esempio n. 4
0
        // GET: Home/Reserver/5
        public ActionResult Reserver(int id)
        {
            reservationvole res = new reservationvole();

            res.vole_id          = id;
            res.users_id         = currentUser.id;
            res.date_reservation = DateTime.Now;
            reservationService.AddReservation(res);
            reservationService.SaveChange();

            IEnumerable <reservationvole> mesReservations = reservationService.GetAllReservationByUser(currentUser.id);

            foreach (var reservat in mesReservations)
            {
                int x;
                if (reservat.vole_id.HasValue)
                {
                    x             = reservat.vole_id.Value;
                    reservat.vole = voleservice.GetVoleById(x);
                }
            }

            return(View(mesReservations));
        }
 public void AddReservation(reservationvole r)
 {
     uow.getRepository <reservationvole>().Add(r);
 }