Beispiel #1
0
 public ActionResult Delete(int judgeId)
 {
     var judge = db.Judges.Find(judgeId);
     if (judge == null)
     {
         return HttpNotFound();
     }
     JudgeViewModel judgeViewModel = new JudgeViewModel()
     {
         JudgeId = judgeId,
         JudgeName = judge.JudgeName,
         JudgeRemarks = judge.JudgeRemarks,
         JudgeStatus = judge.JudgeStatus
     };
     return View(judgeViewModel);
 }
Beispiel #2
0
        public ActionResult CreateJudge(JudgeViewModel judgeViewModel)
        {
            if (ModelState.IsValid)
            {
                var maxId = db.Judges.Max(j => j.JudgeId) + 1;
                var userId = User.Identity.GetUserId();
                var judge = new Judge()
                {
                    JudgeId = maxId,
                    JudgeCode = "J" + maxId,
                    JudgeName = judgeViewModel.JudgeName,
                    JudgeRemarks = judgeViewModel.JudgeRemarks,
                    JudgeStatus = judgeViewModel.JudgeStatus,
                    JudgeDateTimeStamp = DateTime.Now,
                    UserId = userId,
                    TerminalName = Environment.MachineName
                };
                db.Judges.Add(judge);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(judgeViewModel);
        }
Beispiel #3
0
        public ActionResult Edit(JudgeViewModel judgeViewModel)
        {
            if (ModelState.IsValid)
            {
                var judge = db.Judges.Find(judgeViewModel.JudgeId);
                judge.JudgeId = judgeViewModel.JudgeId;
                judge.JudgeName = judgeViewModel.JudgeName;
                judge.JudgeRemarks = judgeViewModel.JudgeRemarks;
                judge.JudgeStatus = judgeViewModel.JudgeStatus;
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(judgeViewModel);
        }
Beispiel #4
0
        public ActionResult Edit(int judgeId)
        {
            Judge judge = db.Judges.Find(judgeId);
            if (judge == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            JudgeViewModel judgeViewModel = new JudgeViewModel()
            {
                JudgeId = judgeId,
                JudgeName = judge.JudgeName,
                JudgeRemarks = judge.JudgeRemarks,
                JudgeStatus = judge.JudgeStatus
            };
            return View(judgeViewModel);
        }