Exemplo n.º 1
0
        public IActionResult Characters()
        {
            if (HttpContext.Session.GetString("Username") == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            var cvm = new CharacterViewModel();

            foreach (Character character in _cr.GetAll(_ar.GetByName(HttpContext.Session.GetString("Username"))))
            {
                cvm.Characters.Add(CharacterToCharacterVM.ToCharVM(character));
            }
            return(View(cvm));
        }
        public ActionResult <IEnumerable <Character> > GetAllCharacters()
        {
            var chars = _mapper.Map <IEnumerable <CharacterResponse> >(_chars.GetAll());

            return(Ok(chars));
        }