Ejemplo n.º 1
0
        public ActionResult Index()
        {
            var x = new SearchViewModel();
            x.Name = HttpContext.User.Identity.Name;

            return View(x);
        }
Ejemplo n.º 2
0
        public ActionResult Search(SearchViewModel model)
        {
            model.Name = HttpContext.User.Identity.Name;

            var repository = new StoreFrontRepository();

            var products = repository.SearchProducts(model.SearchText);

            model.Results = products.Select(x => new SearchResultViewModel
            {
                Id = x.Id,
                Name = x.Name,
                Price = x.Price,
                ImageFile = x.ImageFile
            }).ToList();

            return View("~/Views/ProductSearch/Index.cshtml", model);
        }