Exemplo n.º 1
0
        public DetailSuperHero(Character character)
        {
            InitializeComponent();

            superHero      = character;
            listViewComics = new ListView();
            listViewEvents = new ListView();
            comicViewModel = new ComicViewModel();

            SuperHeroDescription.BindingContext = superHero;
            BindingContext = comicViewModel;

            if (superHero.UrlDetail == null)
            {
                buttonDetail.IsEnabled = false;
            }
            if (superHero.UrlWiki == null)
            {
                buttonWiki.IsEnabled = false;
            }
            if (superHero.UrlComic == null)
            {
                buttonComics.IsEnabled = false;
            }

            buttonDetail.Clicked += ButtonDetail_Clicked;
            buttonWiki.Clicked   += ButtonWiki_Clicked;
            buttonComics.Clicked += ButtonComics_Clicked;

            CreateTabView();
        }
Exemplo n.º 2
0
        public void SetCorrectlyAllPropertiesWhenInitialized()
        {
            //Arrange
            var comic = new Comic()
            {
                Id             = 1,
                Name           = "name",
                Description    = "desc",
                AvailableCount = 2,
                Category       = "marvel",
                ImageUrl       = "http://site.com",
                Price          = 12.5m,
                Orders         = new List <Order>()
                {
                    new Order()
                }
            };

            //Act
            var comicViewModel = new ComicViewModel(comic);

            //Assert
            Assert.AreEqual(comic.Id, comicViewModel.Id);
            Assert.AreEqual(comic.AvailableCount, comicViewModel.AvailableCount);
            Assert.AreEqual(comic.Price, comicViewModel.Price);
            Assert.AreEqual(comic.Name, comicViewModel.Name);
            Assert.AreEqual(comic.Description, comicViewModel.Description);
            Assert.AreEqual(comic.Category, comicViewModel.Category);
            Assert.AreEqual(comic.ImageUrl, comicViewModel.ImageUrl);
            Assert.AreEqual(comic.OrderedItemsCount, comicViewModel.OrderedItemsCount);
            Assert.AreEqual(comic.Orders, comicViewModel.Orders);
        }
Exemplo n.º 3
0
        // GET: Comics/Details/5
        public async Task <IActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            var comic = await _context.Comics
                        .Include(c => c.Scenariste)
                        .Include(c => c.Dessinateur)
                        .Include(c => c.Editeur)
                        .Include(c => c.Genre)
                        .SingleOrDefaultAsync(m => m.Id == id);

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

            var vm = new ComicViewModel
            {
                Comic = comic
            };

            return(View(vm));
        }
Exemplo n.º 4
0
        public ComicView(Comic comic)
        {
            InitializeComponent();

            _comic = comic;

            BindingContext = new ComicViewModel();
        }
Exemplo n.º 5
0
        void PageViewer_OnPageNeeded(object sender, Components.Controls.PageControl.PageRoutedEventArgs e)
        {
            ComicViewModel bvm = DataContext as ComicViewModel;

            //if( bvm.IsInEditMode )
            //    bvm.CurrentPage.Frames = this.PageViewer.FrameList;

            bvm.BookChangePageCommand.Execute(e.PageOffset.ToString());
        }
Exemplo n.º 6
0
        public MainWindow()
        {
            InitializeComponent();

            // set the current culture for the datetime converter
            this.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag);

            var httpClient = new HttpClient();

            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            var comicService = new WebComicService(httpClient);

            viewModel        = new ComicViewModel(comicService);
            this.DataContext = viewModel;
        }
        public async Task <IActionResult> Index(string category, int page = 1)
        {
            ComicViewModel viewModel = new ComicViewModel();

            viewModel.Categories = await _context.Comics.Select(c => c.Category).Distinct().ToListAsync();

            if (category == null)
            {
                viewModel.Comics = await _context.Comics
                                   .Include(m => m.Product)
                                   .Where(p => p.Product.Available > 0)
                                   .ToListAsync();

                viewModel.CurrentPage = page;
                return(View(viewModel));
            }
            else
            {
                if (_context.Comics.Where(p => p.Category == category).Any())
                {
                    viewModel.CurrentCategory = category;
                    viewModel.Comics          = await _context.Comics
                                                .Include(m => m.Product)
                                                .Where(p => p.Category == category &&
                                                       p.Product.Available > 0)
                                                .ToListAsync();

                    viewModel.CurrentPage = page;
                    return(View(viewModel));
                }
                else
                {
                    return(BadRequest());
                }
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Constructor for ComicController.
 /// </summary>
 public ComicController()
 {
     m_vm            = new ComicViewModel();
     m_marvelservice = new MarvelComicService();
 }
Exemplo n.º 9
0
 public void SetUpTest()
 {
     viewModel = new ComicViewModel(comicService);
 }
 public IActionResult AddComic(ComicViewModel model)
 {
     return(View());
 }
Exemplo n.º 11
0
        void PageViewer_OnZoomChanged(object sender, Components.Controls.PageControl.ZoomRoutedEventArgs e)
        {
            ComicViewModel bvm = DataContext as ComicViewModel;

            bvm.Scale = e.Scale;
        }