// // 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); }
public ActionResult Index() { var kw = kwRepository.GetAll().ToList(); ViewBag.keywords = string.Join(",",kw); int pagenum = 1; List<AmazonItem> list = new List<AmazonItem>(); List<AmazonItem> list2 = new List<AmazonItem>(); List<AmazonItem> listu = new List<AmazonItem>(); int total = kwRepository.GetAll().Count(); AmazonServices Amazonhelper = new AmazonServices(); //Amazon only allows 10 pages while (listu.Count < 16 && pagenum < 11) { Helpers helper = new Helpers(); var a = helper.RandomKeyword(total); var b = helper.RandomKeyword(total); // string catA = catRepository.GetById(a.CategoryId).CategoryName; // string catB = catRepository.GetById(b.CategoryId).CategoryName; list = Amazonhelper.ItemSearch( pagenum.ToString(),a.KeywordName, null); list2 = Amazonhelper.ItemSearch(pagenum.ToString(),b.KeywordName, null); foreach (var prod in list2) { for (int i = list.Count - 1; i >= 0; i--) { if (list[i].Equals(prod)) list.Remove(prod); } } listu.AddRange(list.Union(list2)); pagenum++; } IndexViewModel model = new IndexViewModel(); model.amazon = listu; return View(model); }