Exemplo n.º 1
0
        public IActionResult Post([FromBody] CreateStageViewModel createStageViewModel)
        {
            return(ApiAction(() =>
            {
                var contract = _mapper.Map <CreateStageContract>(createStageViewModel);
                var returnContract = _processStageService.Create(contract);

                return Created("Get", _mapper.Map <CreatedStageViewModel>(returnContract));
            }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> CreateStageAsync([FromBody] CreateStageViewModel createStageViewModel)
        {
            var createStageDTO = _mapper.Map <CreateStageDTO>(createStageViewModel);

            var stageDTO = await _stageService.CreateStageAsync(createStageDTO);

            var stageViewModel = _mapper.Map <StageViewModel>(stageDTO);

            return(Ok(stageViewModel));
        }
Exemplo n.º 3
0
        public ActionResult Create(int characterID, int afflictionID, int stageNum)
        {
            var _db = new Entities();
            var vm  = new CreateStageViewModel();

            vm.CharacterID   = characterID;
            vm.CharacterName = _db.Characters.Where(c => c.CharacterId == characterID).FirstOrDefault().Name;
            vm.AfflictionID  = afflictionID;
            vm.StageNum      = stageNum;
            var affliction = _db.Afflictions.Where(a => a.AfflicationId == afflictionID).FirstOrDefault();

            vm.IsVictimAffliction = affliction.IsAdvancedIllness;
            vm.AfflictionName     = affliction.Name;
            return(View(vm));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Create(CreateStageViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (await _stageClient.Create(User.Identity.Name, model.StageName))
            {
                SetUiMessage(UiMessageTypes.Info, "The stage was created.");

                return(RedirectToAction("Index"));
            }

            SetUiMessage(UiMessageTypes.Error, "The stage could not be created.");

            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult Create(CreateStageViewModel model)
        {
            var _db                 = new Entities();
            var affliction          = _db.Afflictions.Where(a => a.AfflicationId == model.AfflictionID).FirstOrDefault();
            var character           = _db.Characters.Where(c => c.CharacterId == model.CharacterID).FirstOrDefault();
            var characterAffliction = new CharacterAffliction()
            {
                AfflictionID     = model.AfflictionID,
                CharacterID      = model.CharacterID,
                Descriptor       = model.Descriptor,
                FinaleText       = model.FinaleText,
                OpponentVoteText = model.OVText,
                SelfVoteText     = model.SVText,
                Stage            = model.StageNum,
                ProgressionText  = model.ProgressionText,
                Character        = character,
                Affliction       = affliction
            };

            _db.CharacterAfflictions.Add(characterAffliction);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }