コード例 #1
0
        public void DeleteVole(int id)
        {
            vole p = uow.getRepository <vole>().GetById(id);

            uow.getRepository <vole>().Delete(p);
            uow.Commit();
        }
コード例 #2
0
        // GET: Home/Details/5
        public ActionResult Details(int id)

        {
            vole u = voleservice.GetVoleById(id);


            VoleModels lum = new VoleModels

            {
                id            = u.id,
                depart        = u.depart,
                destination   = u.destination,
                prix_unitaire = u.prix_unitaire,
                nb_place      = u.nb_place,
                date_depart   = u.date_depart,
                date_arrive   = u.date_arrive
            };

            ViewBag.nbrreservation = reservationService.nbreRservationByVole(lum.id);
            if (lum == null)
            {
                return(HttpNotFound());
            }

            return(View(lum));
        }
コード例 #3
0
 public ActionResult Edit(vole c)
 {
     if (ModelState.IsValid)
     {
         voleservice.Update(c);
         return(RedirectToAction("Index"));
     }
     return(View(c));
 }
コード例 #4
0
        // GET: House/Edit/5
        public ActionResult Edit(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            vole c = voleservice.GetVoleById(id);

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

            return(View(c));
        }
コード例 #5
0
        public ActionResult Create(VoleModels u)
        {
            vole h = new vole
            {
                id          = u.id,
                date_arrive = u.date_arrive,
                date_depart = u.date_depart,
                depart      = u.depart,
                destination = u.destination,
                nb_place    = u.nb_place,

                prix_unitaire = u.prix_unitaire
            };

            voleservice.AddVole(h);
            voleservice.SaveChange();
            return(RedirectToAction("Create"));
        }
コード例 #6
0
        /*  public Dictionary<string, int> StatVole()
         * {
         *    {
         *
         *        var ss = from vole u in uow.getRepository<vole>().GetAll()
         *                 group u by u.type into g
         *                 select new { g.Key, Count = g.Count() };
         *        Dictionary<string, int> typeHouse = new Dictionary<string, int>();
         *        foreach (var t in ss)
         *        {
         *            typeHouse.Add(t.Key, t.Count);
         *            Console.WriteLine(t.Key + "" + t.Count);
         *        }
         *        return typeHouse;
         *    }
         * }*/

        public void Update(vole h)
        {
            uow.getRepository <vole>().Update(h);
            uow.Commit();
        }
コード例 #7
0
 public void AddVole(vole vole)
 {
     uow.VoleRepository.Add(vole);
 }