コード例 #1
0
        public async Task <IActionResult> AccepterFeat([Bind("Id, CreationDate, RealisationDate, HeureDebut, HeureFin, AcceptationDate, EnCoursRealisation, SurPlace, FinFeatHelper, ClotureDate, SommePrevoir, SommeAvancee, SommeRembourseeDate, AnnulationDate, EchangeMonetaire, AideChoisie, Materiel")] int IdMembre, int IdFeat)
        {
            Membre membreLogged = _context.Membres
                                  .Where(b => b.Id == IdMembre)
                                  .FirstOrDefault();

            Feat featEnAttente = _context.Feats
                                 .Where(b => b.Id == IdFeat)
                                 .FirstOrDefault();

            featEnAttente.AcceptationDate = DateTime.Now;

            ReponseHelper reponseHelper = new ReponseHelper()
            {
                AcceptationDate = DateTime.Now,
                Helper          = membreLogged,
                Feat            = featEnAttente
            };


            if (ModelState.IsValid)
            {
                _context.Add(reponseHelper);
                _context.Update(featEnAttente);
                await _context.SaveChangesAsync();

                return(RedirectToAction("MesFeatsHelper", "PAFeats", new { @id = IdMembre }));
            }
            return(RedirectToAction("HomeFeatsHome"));
        }
コード例 #2
0
        public ActionResult DesistementFeat(int IdMembre, int IdFeat)
        {
            ReponseHelper reponseFeatDesistement = _context.ReponseHelpers
                                                   .Where(b => b.Feat.Id == IdFeat)
                                                   .Where(b => b.DesistementDate == null)
                                                   .FirstOrDefault();
            Feat feat = GetFeat(IdFeat);

            feat.AcceptationDate = null;

            reponseFeatDesistement.DesistementDate = DateTime.Now;


            _context.UpdateRange(reponseFeatDesistement, feat);
            _context.SaveChanges();

            Membre membre = _context.Membres
                            .Where(b => b.Id == IdMembre)
                            .FirstOrDefault();

            ViewBag.PrenomMembre = membre.Prenom;
            ViewBag.NomMembre    = membre.Nom;

            return(RedirectToAction("MesFeatsHelper", "PAFeats", new { @id = IdMembre }));
        }
コード例 #3
0
        public async Task <IActionResult> MeDesisterDuFeat([Bind("Id, AcceptationDate, DesistementDate")] ReponseHelper reponseFeatDesistement, int IdFeat, int IdMembre)
        {
            Feat featDesistement = _context.Feats
                                   .Where(b => b.Id == IdFeat)
                                   .Include(b => b.Createur)
                                   .Include(b => b.Type)
                                   .Include(b => b.Materiel)
                                   .FirstOrDefault();

            featDesistement.AcceptationDate        = null;
            reponseFeatDesistement.DesistementDate = DateTime.Now;
            if (ModelState.IsValid)
            {
                _context.Update(featDesistement);
                _context.Update(reponseFeatDesistement);
                await _context.SaveChangesAsync();

                return(RedirectToAction("MesFeatsHelper", "PAFeats", new { @id = IdMembre }));
            }
            return(View("HomeFeatsHome"));
        }