Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 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() }));
        }