public IActionResult Biography(Guid characterId)
        {
            var character = _repository.GetCharacter(characterId);

            if (character == null)
            {
                return(NotFound());
            }

            if (!IsCharacterEditAuthorised(character))
            {
                return(Unauthorized());
            }

            BiographyViewModel viewModel = _viewModelFactory.CreateNew <BiographyViewModel>(character);

            return(View("Biography", viewModel));
        }
        // GET: Biography/Details/5
        public async Task <IActionResult> Details(string id)
        {
            try
            {
                var vm = new BiographyViewModel()
                {
                    Id = id
                };
                BiographyDto dto = await _mediator.Send(_mapper.Map <BiographyQuery>(vm));

                var biography = _mapper.Map <BiographyViewModel>(dto);

                return(View(biography));
            }
            catch (Exception ex)
            {
                return(NotFound());
            }
        }
Beispiel #3
0
        public ActionResult DetailsBio(int UserId)
        {
            var item = _userRepository.FirstOrDefault(x => x.Id == UserId, x => x, null);

            if (item == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            BiographyViewModel model = new BiographyViewModel();

            model._entity = item;

            // Spread Box
            dynamic spreadBox = new ExpandoObject();

            spreadBox.header = new CardHeaderModel()
            {
                _icon = "fa fa-share-alt", _label = "Spread box", _link = "#", _tooltip = "Spread box"
            };
            spreadBox.body = new CardBodyModel()
            {
                _text = "spread item"
            };
            model._spreadBox = spreadBox;

            // Chat Wing
            dynamic chatWing = new ExpandoObject();

            chatWing.header = new CardHeaderModel()
            {
                _label = "Chat Wings", _tooltip = "Chat Wings", _link = "#"
            };
            chatWing.body = new CardBodyModel()
            {
                _text = "Chat you've bought"
            };
            model._chatWing = chatWing;

            FillBaseModel(model);
            return(View(model));
        }
        public IActionResult Biography(BiographyViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var character = _repository.GetCharacter(viewModel.CharacterId);
                if (character == null)
                {
                    return(NotFound());
                }

                if (!IsCharacterEditAuthorised(character))
                {
                    return(Unauthorized());
                }

                character.Biography = viewModel.Biography;
                _repository.AddOrUpdateCharacter(character, false);

                return(RedirectToAction("Sheet", "Character", new { characterId = viewModel.CharacterId }));
            }

            return(View("Biography", viewModel));
        }
 public ActionResult Bio(BiographyViewModel model)
 {
     return(View());
 }