public IActionResult SelectSpells(string pcId, int campaignId) { var query = new GetSpellOptionsQuery { PcId = Convert.ToInt32(Decrypt(pcId)), CampaignId = campaignId }; var model = new SpellSelectModel(); model.checkboxSelectModel = _mapper.Map <List <SpellDTO>, CheckboxSelectModel <SpellModel> >(SendQuery <GetSpellOptionsQuery, IEnumerable <SpellDTO> >(query).ToList()); model.checkboxSelectModel.PcId = pcId; model.checkboxSelectModel.CampaignId = campaignId; //model.radioSelectModel = _mapper.Map<PcSpellDTO, RadioSelectModel<SpellModel>>(SendQuery<GetPcSpellsQuery, PcSpellDTO>(query)); //model.radioSelectModel.PcId = pcId; //model.radioSelectModel.CampaignId = campaignId; if (model.checkboxSelectModel.Options.Where(n => n.IsSelected).Count() == model.checkboxSelectModel.NumberOfSelections) { return(SelectSpells(model)); } return(View(model)); }
public IActionResult SelectSpells(SpellSelectModel model) { var pcId = Convert.ToInt32(Decrypt(model.checkboxSelectModel.PcId)); SendCommand(new SetPCSpellsCommand { PcId = pcId, SpellToRemove = model.radioSelectModel.SelectedOptionId, Spells = model.checkboxSelectModel.Options.Where(n => n.IsSelected).Select(n => n.Id).ToList() }); return(RedirectToAction(nameof(SelectSpells), new { model.checkboxSelectModel.PcId, model.checkboxSelectModel.CampaignId })); }