Пример #1
0
      public async Task <IActionResult> Edit(int id, [Bind("ID,GivenName,FamilyName,DateCreated,Creator")] ParticipantQOTD participantQOTD)
      {
          if (id != participantQOTD.ID)
          {
              return(NotFound());
          }

          if (ModelState.IsValid)
          {
              try
              {
                  _context.Update(participantQOTD);
                  await _context.SaveChangesAsync();
              }
              catch (DbUpdateConcurrencyException)
              {
                  if (!ParticipantQOTDExists(participantQOTD.ID))
                  {
                      return(NotFound());
                  }
                  else
                  {
                      throw;
                  }
              }
              return(RedirectToAction(nameof(Index)));
          }
          return(View(participantQOTD));
      }
      public async Task <IActionResult> Edit(int id, [Bind("id,Question,QuestionAuthor,QuestionDate,Theme")] ParticipantQOTD Participant)
      {
          if (id != Participant.id)
          {
              return(NotFound());
          }

          if (ModelState.IsValid)
          {
              try
              {
                  _context.Update(Participant);
                  await _context.SaveChangesAsync();
              }
              catch (DbUpdateConcurrencyException)
              {
                  if (!QOTDExists(Participant.id))
                  {
                      return(NotFound());
                  }
                  else
                  {
                      throw;
                  }
              }
              return(RedirectToAction(nameof(Index)));
          }
          return(View(Participant));
      }
Пример #3
0
      public async Task <IActionResult> Create([Bind("ID,GivenName,FamilyName,DateCreated,Creator")] ParticipantQOTD participantQOTD)
      {
          if (ModelState.IsValid)
          {
              _context.Add(participantQOTD);
              await _context.SaveChangesAsync();

              return(RedirectToAction(nameof(Index)));
          }
          return(View(participantQOTD));
      }
      public async Task <IActionResult> Create([Bind("id,Question,QuestionAuthor,QuestionDate,Theme")] ParticipantQOTD Participant)
      {
          if (ModelState.IsValid)
          {
              _context.Add(Participant);
              await _context.SaveChangesAsync();

              return(RedirectToAction(nameof(Index)));
          }
          return(View(Participant));
      }