Exemplo n.º 1
0
        public ViewResult Index()
        {
            var homeCars = new HomeViewModal
            {
                favCars = _carRep.getFavCars
            };

            return(View(homeCars));
        }
Exemplo n.º 2
0
        public ActionResult Index(int?id)
        {
            try
            {
                int pageIndex = id - 1 ?? 0;
                int pageSize  = 9;

                var products = _context.Products.OrderByDescending(it => it.Id).Skip(pageIndex * pageSize).Take(pageSize).ToList();

                var viewModal = new HomeViewModal
                {
                    product = products
                };

                return(View(viewModal));
            }
            catch (Exception ex)
            {
                throw new Exception("Sorry there is some error loading Product", ex);
            }
        }