Пример #1
0
        public ActionResult Create(Paragraphe paragraphe)
        {
            this._context.Paragraphes.Add(paragraphe);
            this._context.SaveChanges();

            return(this.View());
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="paragraphe"></param>
 /// <returns></returns>
 public static ParagrapheRepresentation Convert(this Paragraphe paragraphe)
 {
     return(new ParagrapheRepresentation()
     {
         Contenu = paragraphe.Contenu
     });
 }
        public IActionResult Edit(int id)
        {
            Paragraphe paragraphe = null;

            paragraphe = this._context.Paragraphes.First(item => item.Id == id);
            return(this.View(paragraphe));
        }
Пример #4
0
        public ActionResult Edit(int id)
        {
            Paragraphe paragraphe = null;

            paragraphe = maListe.First(item => item.Id == id);
            return(View(paragraphe));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Numero,Titre,Description")] Paragraphe paragraphe)
        {
            if (id != paragraphe.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paragraphe);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QuestionExists(paragraphe.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(paragraphe));
        }
Пример #6
0
        public ActionResult Edit([Bind(Include = "id,titre,contenu,link,position,PageId")] Paragraphe paragraphe)
        {
            if (ModelState.IsValid)
            {
                var id = Request["id"];
                var p  = paragrapheService.GetById(Int32.Parse(id));



                p.page     = paragraphe.page;
                p.PageId   = paragraphe.PageId;
                p.titre    = paragraphe.titre;
                p.contenu  = paragraphe.contenu;
                p.link     = paragraphe.link;
                p.position = paragraphe.position;



                // p.paragImages = new List<Parag_image>();
                //  p.paragImages.Add(paragImage);


                paragrapheService.Update(p);
                paragrapheService.Commit();



                return(RedirectToAction("Index"));
            }
            ViewBag.PageId = new SelectList(db.pages, "id", "nom", paragraphe.PageId);
            return(View(paragraphe));
        }
        public ActionResult Index()
        {
            Paragraphe          monParagraphe = new Paragraphe();
            ParagrapheDataLayer dataLayer     = new ParagrapheDataLayer();

            monParagraphe = dataLayer.GetOne(2);
            return(View(monParagraphe));
        }
Пример #8
0
        public ActionResult Update(int Id)
        {
            Paragraphe paragraphe = null;

            paragraphe = _maList.First(item => item.Id == Id);

            return(this.View(paragraphe));
        }
Пример #9
0
 public void Add(Paragraphe paragraphe)
 {
     using (JeuDroidesEntities context = new JeuDroidesEntities())
     {
         context.Paragraphe.Add(paragraphe);
         context.SaveChanges();
     }
 }
Пример #10
0
        public ActionResult DeleteConfirmed(int id)
        {
            Paragraphe paragraphe = db.paragraphes.Find(id);

            db.paragraphes.Remove(paragraphe);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public Question GetQuestion(Paragraphe p)
 {
     using (JeuDontOnEstLeHerosEntities context = new JeuDontOnEstLeHerosEntities())
     {
         return((from q in context.Question
                 where p.Id == q.ParagrapheId
                 select q).Single());
     }
 }
        public ActionResult Edit(Paragraphe paragraphe)
        {
            //this._context.Paragraphes.Update(paragraphe);
            this._context.Attach <Paragraphe>(paragraphe);
            this._context.Entry(paragraphe).Property(item => item.Titre).IsModified = true;
            this._context.SaveChanges();

            return(this.View(paragraphe));
        }
        public ActionResult One(int id)
        {
            Paragraphe paragraphe = pLayer.GetOne(id);
            Question   question   = pLayer.GetQuestion(paragraphe);

            ViewBag.Question = question;
            ViewBag.Reponses = qLayer.GetReponses(question);
            return(View(paragraphe));
        }
        public IActionResult Edit(Paragraphe paragraphe)
        {
            this._context.Paragraphes.Update(paragraphe);



            this._context.SaveChanges();
            return(this.View(paragraphe));
        }
        public ParagrapheRepresentation Get(int id)
        {
            ParagrapheDataLayer layer = new ParagrapheDataLayer();
            Paragraphe          paragrapheVenantDEntities = layer.GetOne(id);

            ParagrapheRepresentation paragrapheARetourner = paragrapheVenantDEntities.Convert();

            return(paragrapheARetourner);
        }
Пример #16
0
        public ActionResult Edit(int id)
        {
            // id (est l'int qu'on rajoute dans l'URL) =/= ID est l'instance du modèle (qu'on essaye de get/post) /!\
            Paragraphe paragraphe = null;

            paragraphe = this._context.Paragraphes.First(item => item.Id == id);

            return(this.View(paragraphe));
        }
        public ActionResult Edit(int id)
        {
            Paragraphe paragraphe = null;

            #region A changer avec l'appel en base de données / entities
            paragraphe = _maList.First(item => item.Id == id);
            #endregion

            return(this.View(paragraphe));
        }
Пример #18
0
        public ActionResult Ajouter(Paragraphe paragraphe)
        {
            using (JeuDroidesEntities context = new JeuDroidesEntities())
            {
                context.Paragraphe.Add(paragraphe);
                context.SaveChanges();
            }

            return(View(paragraphe));
        }
Пример #19
0
        public ActionResult Index(string testinput)
        {
            Paragraphe monParagraphe = new Paragraphe();

            monParagraphe.Initialise(int.Parse(testinput));


            this.ViewBag.monParagraphe = monParagraphe;
            return(View());
        }
Пример #20
0
        public IActionResult Create(Paragraphe paragraphe)
        {
            if (this.ModelState.IsValid)
            {
                this._context.Paragraphes.Add(paragraphe);
                this._context.SaveChanges();
            }

            return(this.View());
        }
 public IActionResult Create(Paragraphe paragraphe)
 {
     //Vérification avant enregistrement en BDD coté server
     if (this.ModelState.IsValid)
     {
         this._context.Paragraphes.Add(paragraphe);
         this._context.SaveChanges();
     }
     return(this.View());
 }
Пример #22
0
        public void Delete(int id)
        {
            Paragraphe paragrapheSelectionne = GetOne(id);

            using (JeuDroidesEntities contexte = new JeuDroidesEntities())
            {
                contexte.Paragraphe.Remove(paragrapheSelectionne);
                contexte.SaveChanges();
            }
        }
 public IActionResult Edit(Paragraphe paragraphe)
 {
     if (ModelState.IsValid)
     {
         if (_daoParagraphe.EditParagraphe(paragraphe).Result)
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(paragraphe));
 }
Пример #24
0
        public ActionResult Create([Bind(Include = "id,titre,contenu,link,position,PageId")] Paragraphe paragraphe)
        {
            if (ModelState.IsValid)
            {
                db.paragraphes.Add(paragraphe);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PageId = new SelectList(db.pages, "id", "nom", paragraphe.PageId);
            return(View(paragraphe));
        }
Пример #25
0
        public ActionResult Edit(int id)
        {
            using (JeuDroidesEntities context = new JeuDroidesEntities())
            {
                var requete = from para in context.Paragraphe
                              where para.Id == id
                              select para;

                Paragraphe monParagraphe = requete.Single();

                return(View(monParagraphe));
            }
        }
        public ActionResult BeginNewOne(int id)
        {
            Paragraphe item = null;

            if (id == 0)
            {
                item = this._paragrapheLayer.GetFirst();
            }
            else
            {
                item = this._paragrapheLayer.GetOne(id);
            }
            return(this.View(item));
        }
Пример #27
0
        // GET: Paragraphes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Paragraphe paragraphe = db.paragraphes.Find(id);

            if (paragraphe == null)
            {
                return(HttpNotFound());
            }
            return(View(paragraphe));
        }
Пример #28
0
        public ActionResult Supprimer(Paragraphe paragraphe)
        {
            using (JeuDroidesEntities context = new JeuDroidesEntities())
            {
                var requete = from para in context.Paragraphe
                              where para.Id == paragraphe.Id
                              select para;

                context.Paragraphe.Remove(requete.Single());
                context.SaveChanges();
            }

            return(View());
        }
Пример #29
0
        // GET: Paragraphes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Paragraphe paragraphe = db.paragraphes.Find(id);

            if (paragraphe == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PageId = new SelectList(db.pages, "id", "nom", paragraphe.PageId);
            return(View(paragraphe));
        }
Пример #30
0
 public IActionResult Edit(Paragraphe paragraphe)
 {
     ///
     /// update de tous les champs
     _context.Paragraphes.Update(paragraphe);
     ///
     //**************
     ///
     ///update d'un seul champ
     ///
     _context.Attach <Paragraphe>(paragraphe);
     //connection sur la valeur dans la table en passant par entity
     //_context.Entry(paragraphe).Property(item => item.Titre).IsModified=true;
     _context.SaveChanges();
     return(View(paragraphe));
 }
        public List<Paragraphe> LireFichiers()
        {
            List<Paragraphe> l = new List<Paragraphe>();

            DirectoryInfo d = new DirectoryInfo(Aventure.Repertoire + "\\Paragraphes");
            Paragraphe pvide = new Paragraphe();
            pvide.NoParagraphe = "";
            l.Add(pvide);
            foreach (FileInfo f in d.GetFiles("*.xml"))
            {
                Paragraphe p = Paragraphe.ChargerFichier(Aventure.Repertoire + "\\Paragraphes\\" + f.ToString());
                l.Add(p);
            }

            return l;
        }
        private void bCreer_Click(object sender, EventArgs e)
        {
            Paragraphe p = new Paragraphe();

            if (!cbNoParagraphe.Text.Trim().Equals(""))
            {
                p.NoParagraphe = cbNoParagraphe.Text;
                p.Pouvoir = (Pouvoirs)cbPouvoir.SelectedItem;
                p.EstZone = !cbZone.Text.Equals("Aucune");
                p.NomZone = !cbZone.Text.Equals("Aucune") ? cbZone.Text : null;
                p.FinExploration = cbFinExplo.Checked;
                p.Texte = rtbTexte.Text;
                int d = 0;
                int.TryParse(tbCombatSimple.Text, out d);
                p.CombatSimple = d;

                foreach (DataGridViewRow r in dgvChoix.Rows)
                {
                    if (r.Cells["Intitule"].Value != null)
                    {
                        Choix c = new Choix();
                        c.Intitule = r.Cells["Intitule"].Value.ToString();
                        c.NoParagraphe = r.Cells["NoParagraphe"].Value.ToString();
                        p.Choix.Add(c);
                    }
                }

                if (dgvRencontres.Rows[0].Cells[0].Value != null)
                {
                    DefisEtSortileges.Personnages.Ennemi en = new Personnages.Ennemi();
                    en.Nom = dgvRencontres.Rows[0].Cells[0].Value.ToString();
                    en.Initiative = int.Parse(dgvRencontres.Rows[0].Cells[1].Value.ToString());
                    en.Combat = int.Parse(dgvRencontres.Rows[0].Cells[2].Value.ToString());
                    en.VitaliteBase = int.Parse(dgvRencontres.Rows[0].Cells[3].Value.ToString());
                    en.Vitalite = int.Parse(dgvRencontres.Rows[0].Cells[3].Value.ToString());
                    en.Blessure = int.Parse(dgvRencontres.Rows[0].Cells[4].Value.ToString());

                    p.Rencontre = en;
                }

                p.SauverFichier(Aventure.Repertoire + "\\Paragraphes\\" + p.NoParagraphe + ".xml");
                Init();
            }
            else MessageBox.Show("Le No. de paragraphe doit etre précisé.");

            cbNoParagraphe.Focus();
        }