Пример #1
0
        public IActionResult SelectArchetype(string pcId, int campaignId, int classId)
        {
            var model = new ArchetypeSelectModel {
                PcId = pcId, CampaignId = campaignId
            };

            var query = new GetArchetypeOptionsQuery
            {
                CampaignId = campaignId,
                PcId       = Convert.ToInt32(Decrypt(pcId))
            };

            var archetypes = SendQuery <GetArchetypeOptionsQuery, IEnumerable <ArchetypeDTO> >(query).ToList();

            if (archetypes.Count() > 0)
            {
                var playerClass = SendQuery <GetClassQuery, ClassDTO>(new GetClassQuery {
                    Id = classId
                });
                model.ArchetypeName        = playerClass.Name;
                model.ArchetypeDescription = playerClass.ArchetypeTypeDescription;

                model.OptionModels = _mapper.Map <List <ArchetypeDTO>, List <ArchetypeModel> >(archetypes);
                return(View(model));
            }

            return(RedirectToAction(nameof(SelectBackground), new { pcId, campaignId }));
        }
Пример #2
0
        public IActionResult SelectArchetype(ArchetypeSelectModel model)
        {
            var pcId = Convert.ToInt32(Decrypt(model.PcId));

            SendCommand(new SetPCArchetypeCommand {
                PcId = pcId, ArchetypeId = model.SelectedOptionId
            });

            return(RedirectToAction(nameof(SelectBackground), new { model.PcId, model.CampaignId }));
        }