コード例 #1
0
        public ActionResult Edit(int id)
        {
            var judge = DP.GetJudgeById(id);

            var model = new JudgeEditionViewModel()
            {
                FirstName = judge.FirstName,
                LastName  = judge.LastName,
                Bio       = judge.Bio,
                Email     = judge.Email
            };

            return(View(model));
        }
コード例 #2
0
        public void Edit(JudgeEditionViewModel model)
        {
            var judgeToEdit = GetJudgeById(model.Id);

            if (judgeToEdit != null)
            {
                judgeToEdit.FirstName = model.FirstName;
                judgeToEdit.LastName  = model.LastName;
                judgeToEdit.Email     = model.Email;
                judgeToEdit.Bio       = model.Bio;

                _Context.SaveChanges();
            }
        }
コード例 #3
0
        public ActionResult Edit(JudgeEditionViewModel model)
        {
            DP.Edit(model);

            return(RedirectToAction("Judges", "Admin"));
        }