コード例 #1
0
        public IActionResult Edit(int id, [Bind("Id,Name,Phone,Email,Address,LinkedinProfile")] Trainer trainer)
        {
            if (id != trainer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _iTrainerManager.Update(trainer);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrainerExists(trainer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(trainer));
        }
コード例 #2
0
        public IActionResult Edit(long id, Trainer trainer)
        {
            if (id != trainer.Id)
            {
                return(NotFound());
            }

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

            return(View(trainer));
        }