Exemplo n.º 1
0
        public IActionResult Edit(long id, Trainee trainee)
        {
            if (id != trainee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    trainee.UpdatedAt = DateTime.Now;
                    _iTraineeManager.Update(trainee);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TraineeExists(trainee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(trainee));
        }
 public IActionResult Edit(int id, [Bind("Id,Name,Email,Phone,Address")] Trainee trainee)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _iTraineeManager.Update(trainee);
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!TraineeExists(trainee.Id))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(trainee));
 }