Ejemplo n.º 1
0
 public ActionResult Index(int? categoryId)
 {
     if(categoryId == null)
     {
         categoryId = 1;
     }
     IndexViewModel viewModel = new IndexViewModel();
     ProductCategoryRepository repo = new ProductCategoryRepository(Properties.Settings.Default.ConStr);
     viewModel.Categories = repo.GetCategories();
     viewModel.Products = repo.GetProcuctsByCategory(categoryId);
     viewModel.Id = categoryId;
     return View(viewModel);
 }
Ejemplo n.º 2
0
        //
        // GET: /Manage/Index
        public async Task<ActionResult> Index(ManageMessageId? message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var userId = User.Identity.GetUserId();
            var model = new IndexViewModel
            {
                HasPassword = HasPassword(),
                PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            };
            return View(model);
        }