/// <summary>
        /// Constructor for Index Page
        ///
        /// Get the ItemIndexView Model
        /// </summary>
        public CharacterIndexPage()
        {
            InitializeComponent();

            BindingContext       = ViewModel = CharacterIndexViewModel.Instance;
            this.ViewModel.Title = "Characters";
        }
Ejemplo n.º 2
0
        public IActionResult Index()
        {
            var model = new CharacterIndexViewModel();

            model.Characters = work.TemplateCharacterRepository.GetAll().Select(e => CharacterModel.GenerateCharacterModelFromDTO(e)).ToList();
            model.Characters = model.Characters.OrderBy(c => c.ID).ToList();
            return(View(model));
        }
Ejemplo n.º 3
0
        public IActionResult Index()
        {
            var model = new CharacterIndexViewModel();

            model.Characters = _characterData.GetAll();

            return(View(model));
        }
        public void Setup()
        {
            // Initilize Xamarin Forms
            MockForms.Init();

            // Add each model here to warm up and load it.
            //Game.Helpers.DataSetsHelper.WarmUp();

            ViewModel = CharacterIndexViewModel.Instance;
        }
        public static CharacterIndexViewModel MapFromCharacterIndex(this IEnumerable <CharacterViewModel> character,
                                                                    int currentPage, int totalPages)
        {
            var model = new CharacterIndexViewModel
            {
                Characters  = character,
                CurrentPage = currentPage,
                TotalPages  = totalPages,
            };

            return(model);
        }
Ejemplo n.º 6
0
        public void CharacterIndexPage_OnAppearing_Valid_Should_Pass()
        {
            // Arrange
            CharacterIndexViewModel ViewModel = CharacterIndexViewModel.Instance;

            // Act
            OnAppearing();

            // Reset

            // Assert
            Assert.IsTrue(true); // Got to here, so it happened...
        }
        public async Task <IActionResult> Index(int?currentPage, string search = null)
        {
            try
            {
                string userId = FindCurrentUserId();

                int currPage   = currentPage ?? 1;
                int totalPages = await _characterServices.GetPageCount();

                IEnumerable <Character> characterAllResults = null;

                if (!string.IsNullOrEmpty(search))
                {
                    //For character search
                    characterAllResults = await _characterServices.SearchCharacter(search, currPage, userId);
                }
                else
                {
                    characterAllResults = await _characterServices.GetAllUserCharactersAsync(currPage, userId);
                }

                IEnumerable <CharacterViewModel> characterListing = characterAllResults
                                                                    .Select(m => CharacterMapper.MapCharacter(m));
                CharacterIndexViewModel characterIVM = CharacterMapper.MapFromCharacterIndex(characterListing,
                                                                                             currPage, totalPages);

                #region For pagination buttons and distribution
                characterIVM.CurrentPage = currPage;
                characterIVM.TotalPages  = totalPages;

                if (totalPages > currPage)
                {
                    characterIVM.NextPage = currPage + 1;
                }

                if (currPage > 1)
                {
                    characterIVM.PreviousPage = currPage - 1;
                }
                #endregion

                return(View(characterIVM));
            }
            catch (GlobalException e)
            {
                //TODO
                return(BadRequest(e.Message));
                //ModelState.AddModelError(string.Empty, ExceptionMessage.GlobalErrorMessage);
                //return RedirectToAction("Index", "Home");
            }
        }
        public IActionResult Index()
        {
            var userId = this.userManager.GetUserId(this.User);

            var characters = this.characterService
                             .GetUserCharacters <CharacterViewModel>(userId);

            var characterIndexViewModel = new CharacterIndexViewModel
            {
                Characters = characters
            };

            return(View(characterIndexViewModel));
        }
Ejemplo n.º 9
0
        public void CharacterIndexPage_ReadCharacter_Clicked_InValid_Should_Pass()
        {
            // Arrange
            CharacterIndexViewModel ViewModel = CharacterIndexViewModel.Instance;
            ImageButton             button    = new ImageButton();

            button.CommandParameter = "bf12cfee-dfc6-4e4f-8a9b-9570177628ba";

            // Act
            page.ReadCharacter_Clicked(button, null);

            // Reset

            // Assert
            Assert.IsTrue(true); // Got to here, so it happened...
        }
        public void CharacterIndexPage_ReadCharacter_Clicked_Default_Should_Pass()
        {
            // Arrange
            CharacterIndexViewModel ViewModel = CharacterIndexViewModel.Instance;
            ImageButton             item      = new ImageButton {
                CommandParameter = ViewModel.Dataset[0].Id
            };

            // Act
            page.ReadCharacter_Clicked(item, null);

            // Reset

            // Assert
            Assert.IsTrue(true); // Got to here, so it happened...
        }
Ejemplo n.º 11
0
        public ActionResult Index()
        {
            // get the active user's account
            var account = m_session.Accounts.GetByEmail(User.Identity.Name);

            if (account == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }

            // initialize the view model, containing all characters
            var model = new CharacterIndexViewModel
            {
                Account = account
            };

            return(View(model));
        }
Ejemplo n.º 12
0
        public void CharacterIndexPage_ReadCharacter_Clicked_Valid_Should_Pass()
        {
            // Arrange
            var data = new CharacterModel();
            CharacterIndexViewModel ViewModel = CharacterIndexViewModel.Instance;

            ViewModel.Dataset.Add(data);
            ImageButton button = new ImageButton();

            button.CommandParameter = data.Id;

            // Act
            page.ReadCharacter_Clicked(button, null);

            // Reset

            // Assert
            Assert.IsTrue(true); // Got to here, so it happened...
        }
Ejemplo n.º 13
0
        public void CharacterImageChangePage_SelectCharacterImage_Clicked_Default_Should_Pass()
        {
            // Arrange
            var data = new CharacterModel();
            CharacterIndexViewModel ViewModel = CharacterIndexViewModel.Instance;

            ViewModel.Dataset.Add(data);
            data.ImageURI = "character_01.png";
            ImageButton button = new ImageButton();

            button.CommandParameter = data;
            // Act
            page.SelectCharacterImage_Clicked(button, null);

            // Reset

            // Assert
            Assert.IsTrue(true); // Got to here, so it happened...
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PickCharactersPage()
 {
     InitializeComponent();
     BindingContext = ViewModel = CharacterIndexViewModel.Instance;
 }