コード例 #1
0
 public ActionResult AcceptBid([PRGInRoute]int? id, CandidateAcceptForm form)
 {
     if (!id.HasValue) return RedirectTo<CandidatesController>(a => a.List());
     form.Candidate = form.Candidate ?? Get<ICandidateRepository>().GetById(id.Value);
     if (form.Candidate == null) return RedirectTo<CandidatesController>(a => a.List());
     form.Doctors = Get<IDoctorRepository>().GetAll();
     return View(form);
 }
コード例 #2
0
 public ActionResult AcceptBid(CandidateAcceptForm form)
 {
     if (ModelState.IsValid)
     {
         form.Candidate = Get<ICandidateRepository>().GetById(form.Candidate.Id);
         Get<IRegistrationService>().AcceptBid(form.Candidate.Id, form.Doctor.Id);
         const string message = "Заявка для кандидата принята.";
         return RedirectTo<CandidatesController>(a => a.ConfirmBid(form.Candidate, message));
     }
     return RedirectTo<CandidatesController>(a => a.AcceptBid(form.Candidate.Id, form));
 }