public async Task <IActionResult> Edit(int id, [Bind("TuristID,TuristName,Phone,Genre,Birthday,NIF,Email,EmergencyContact,TuristState,TypeTurist")] Turist turist)
        {
            if (id != turist.TuristID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(turist);


                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TuristExists(turist.TuristID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(turist));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("TuristAnswerID,SurveyNumber,AnswerDate,TuristAnswerState,TuristID,AnswerID")] TuristAnswer turistAnswer)
        {
            if (id != turistAnswer.TuristAnswerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(turistAnswer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TuristAnswerExists(turistAnswer.TuristAnswerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["AnswerID"] = new SelectList(_context.Answer, "AnswerID", "AnswerID", turistAnswer.AnswerID);
            ViewData["TuristID"] = new SelectList(_context.Turist, "TuristID", "Email", turistAnswer.TuristID);
            return(View(turistAnswer));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AnswerID,PossibleAnswer,QuestionsID,DifficultyID")] Answer answer)
        {
            if (id != answer.AnswerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(answer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AnswerExists(answer.AnswerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["DifficultyID"] = new SelectList(_context.Difficulty, "DifficultyID", "DifficultyID", answer.DifficultyID);
            ViewData["QuestionsID"]  = new SelectList(_context.Questions, "QuestionsID", "QuestionsID", answer.QuestionsID);
            return(View(answer));
        }
        public async Task <IActionResult> Edit(int id, [Bind("QuestionsID,QuestionsToClient,QuestionsState")] Questions questions)
        {
            if (id != questions.QuestionsID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(questions);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QuestionsExists(questions.QuestionsID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(questions));
        }