public async Task <IActionResult> Edit(int id, [Bind("Id,GradeId,ProfilId,DifficulteMaths,Xpmaths,DifficulteFrancais,Xpfrancais,DifficulteAnglais,Xpanglais")] Progression progression)
        {
            if (id != progression.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(progression);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProgressionExists(progression.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GradeId"]  = new SelectList(_context.Grade, "Id", "Nom", progression.GradeId);
            ViewData["ProfilId"] = new SelectList(_context.Profil, "Id", "Nom", progression.ProfilId);
            return(View(progression));
        }
        public async Task <IActionResult> Create([Bind("Id,GradeId,SujetId,QuestionText,Difficult,Explanation,GoodAnswers,BadAnswers")] Question question)
        {
            if (ModelState.IsValid)
            {
                _context.Add(question);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GradeId"] = new SelectList(_context.Grade, "Id", "Id", question.GradeId);
            ViewData["SujetId"] = new SelectList(_context.Sujet, "Id", "Id", question.SujetId);
            return(View(question));
        }
        public async Task <IActionResult> Create([Bind("Id,ProfilId,GradeId,DateResultat,DifficulteMaths,ResMaths,DifficulteFrancais,ResFrancais,DifficulteAnglais,ResAnglais")] Resultat resultat)
        {
            if (ModelState.IsValid)
            {
                _context.Add(resultat);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GradeId"]  = new SelectList(_context.Grade, "Id", "Nom", resultat.GradeId);
            ViewData["ProfilId"] = new SelectList(_context.Profil, "Id", "Nom", resultat.ProfilId);
            return(View(resultat));
        }
Exemple #4
0
        public async Task <IActionResult> PutProfil(int id, Profil profil)
        {
            if (id != profil.Id)
            {
                return(BadRequest());
            }

            _context.Entry(profil).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfilExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #5
0
        public async Task <ActionResult <Resultat> > PostResultat(Resultat resultat)
        {
            Console.WriteLine("Resultat reçu" + resultat.ToString());
            resultat.DateResultat = DateTime.Now;
            _context.Resultat.Add(resultat);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetResultat", new { id = resultat.Id }, resultat));
        }