public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Entite).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EntiteExists(Entite.EntiteId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }


            _context.Attach(Question).State = EntityState.Modified;

            try
            {
                if (uneOption.Label != null)
                {
                    uneOption.QuestionId = Question.QuestionId;
                    _context.Option.Add(uneOption);
                }

                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!QuestionExists(Question.QuestionId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            //  return RedirectToPage("./Index");
            return(RedirectToPage("/Admin/Details", new { id = Question.QuestionId.ToString() }));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Entite.Add(Entite);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemple #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Question = await _context.Question.FindAsync(id);

            if (Question != null)
            {
                _context.Question.Remove(Question);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Entite = await _context.Entite.FindAsync(id);

            if (Entite != null)
            {
                _context.Entite.Remove(Entite);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }