コード例 #1
0
 public ActionResult AddParticipantChooseBedCode(AddParticipantChooseBedCodeViewModel viewModel)
 {
     if (viewModel.Cancel != null)
     {
         return this.RedirectToAction(c => c.AddParticipant(viewModel.RetreatId));
     }
     else
     {
         var result = _commandInvoker.Invoke(viewModel,
                                             typeof(AddExistingParticipantToRetreatCommand),
                                             () => this.RedirectToAction(c => c.Index(viewModel.RetreatId)),
                                             () => this.RedirectToAction(c => c.Index(viewModel.RetreatId)),
                                             ModelState);
         return result;
     }
 }
コード例 #2
0
        public ViewResult AddParticipantChooseBedCode(int retreatId, int participantId)
        {
            var retreat = _retreatRepository.GetById(retreatId);

            var beds = retreat.GetUnassignedBeds(_bedRepository.GetAll());
            var bedCodes = beds.Select(x => x.Code);
            
            var model = new AddParticipantChooseBedCodeViewModel
            {
                RetreatId = retreatId,
                ParticipantId = participantId,
                BedCodeList = new[] { "(none)" }.Concat(bedCodes).ToArray(),
                BedCode = "(none)",
            };
            return View(model);
        }