Ejemplo n.º 1
0
        public IActionResult Index()
        {
            musicQuotesRepo repo = new musicQuotesRepo();

            QuoteIndexViewModel viewModel = new QuoteIndexViewModel();

            viewModel.Quotes = repo.GetAllQuotes();

            return(View(viewModel));
        }
        public async Task <IActionResult> Index()
        {
            ApplicationUser user = await GetCurrentUserAsync();

            QuoteIndexViewModel model = new QuoteIndexViewModel(_context);

            model.Quotes = await _context.Quotes.Where(quote => quote.ApplicationUserId == user.Id).ToListAsync();

            return(View(model));

            //var applicationDbContext = _context.Quotes.Include(m => m.ApplicationUser);
            //return View(await applicationDbContext.ToListAsync());

            ////QuoteIndexViewModel quoteIndexViewModel = new QuoteIndexViewModel(_context.Quotes);
            ////return View(await quoteIndexViewModel);
        }