public ActionResult Reset() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); return(View()); }
public ActionResult Search(String SupplierId = "", int CategoryId = 0, String Keywords = "") { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); if (SupplierId != "") { var model = db.Products .Where(p => p.SupplierId == SupplierId); return(View(model)); } else if (CategoryId != 0) { var model = db.Products .Where(p => p.CategoryId == CategoryId); return(View(model)); } else if (Keywords != "") { var model = db.Products .Where(p => p.Name.Contains(Keywords)); return(View(model)); } return(View(db.Products)); }
public async Task <ActionResult> ConfirmPhone(InputModel model) { string ur = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(ur); var client = new HttpClient(); // Add authentication header var AuthyAPIKey = "E09FjK58eXC4oLAovzH9VBxFGzcAlobB"; client.DefaultRequestHeaders.Add("X-Authy-API-Key", AuthyAPIKey); var phone_number = model.PhoneNumber; var country_code = model.DialingCode; var verification_code = model.VerificationCode; var url = $"https://api.authy.com/protected/json/phones/verification/check?" + "&phone_number=" + phone_number + "&country_code=" + country_code + "&verification_code=" + verification_code; HttpResponseMessage response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { return(RedirectToAction("Index", "Home")); } else { return(View(model)); } }
public async Task <ActionResult> Login(LoginViewModel model, string returnUrl) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); Session.Remove("guid"); // AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); if (ModelState.IsValid) { var user = await UserManager.FindAsync(model.UserName, model.Password); if (user != null) { await SignInAsync(user, model.RememberMe); // return RedirectToLocal(returnUrl); return(View("VerifyPhone")); } else { ModelState.AddModelError("", "Invalid username or password."); } } // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult Confirm(InputModel model) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); return(View(model)); }
public ActionResult Register() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); Session.Remove("guid"); return(View()); }
public ActionResult Contact() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); ViewBag.Message = "Liên hệ"; return(View()); }
public ActionResult About() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); ViewBag.Message = "Giới thiệu về Multishop"; return(View()); }
public ActionResult Detail(int id) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); var order = db.Orders.Find(id); return(View(order)); }
// // GET: /Account/LogOff public ActionResult LogOff() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); AuthenticationManager.SignOut(); Session.Remove("guid"); return(RedirectToAction("Index", "Home")); }
public ActionResult Index() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); var cart = ShoppingCart.Cart; return(View(cart.Items)); }
public ActionResult List() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); var orders = db.Orders .Where(o => o.CustomerId == User.Identity.Name); return(View(orders)); }
public ActionResult Index() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); var model = db.Categories .Where(c => c.Products.Count >= 4) .OrderBy(c => Guid.NewGuid()).ToList(); return(View(model)); }
public async Task <ActionResult> Manage(ManageUserViewModel model) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); bool hasPassword = HasPassword(); ViewBag.HasLocalPassword = hasPassword; ViewBag.ReturnUrl = Url.Action("Manage"); if (hasPassword) { if (ModelState.IsValid) { IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword); if (result.Succeeded) { return(RedirectToAction("Manage", new { Message = ManageMessageId.ChangePasswordSuccess })); } else { AddErrors(result); } } } else { // User does not have a password so remove any validation errors caused by a missing OldPassword field ModelState state = ModelState["OldPassword"]; if (state != null) { state.Errors.Clear(); } if (ModelState.IsValid) { IdentityResult result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword); if (result.Succeeded) { return(RedirectToAction("Manage", new { Message = ManageMessageId.SetPasswordSuccess })); } else { AddErrors(result); } } } // If we got this far, something failed, redisplay form return(View(model)); }
// // GET: /Product/ public ActionResult Category(int CategoryID = 0) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); if (CategoryID != 0) { ViewBag.TieuDe = db.Categories.SingleOrDefault(p => p.Id == CategoryID).Name; var model = db.Products.Where(p => p.CategoryId == CategoryID); return(View(model)); } return(View()); }
// // GET: /Order/ public ActionResult Checkout() { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); var model = new Order(); model.CustomerId = User.Identity.Name; model.OrderDate = DateTime.Now.Date; model.Amount = ShoppingCart.Cart.Total; return(View(model)); }
// // GET: /Account/Manage public ActionResult Manage(ManageMessageId?message) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); ViewBag.StatusMessage = message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed." : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set." : message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed." : message == ManageMessageId.Error ? "An error has occurred." : ""; ViewBag.HasLocalPassword = HasPassword(); ViewBag.ReturnUrl = Url.Action("Manage"); return(View()); }
public ActionResult Login(string returnUrl) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); if (returnUrl != null) { if (returnUrl.Contains("/Admin/")) { Response.Redirect("/Admin/Account/Login?returnUrl=" + returnUrl); } ViewBag.ReturnUrl = returnUrl; } return(View()); }
public ActionResult Detail(int id, string SupplierID) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); var model = db.Products.Find(id); // Tăng số lần xem model.Views++; db.SaveChanges(); // Lấy cookie cũ tên views var views = Request.Cookies["views"]; // Nếu chưa có cookie cũ -> tạo mới if (views == null) { views = new HttpCookie("views"); } // Bổ sung mặt hàng đã xem vào cookie views.Values[id.ToString()] = id.ToString(); // Đặt thời hạn tồn tại của cookie views.Expires = DateTime.Now.AddMonths(1); // Gửi cookie về client để lưu lại Response.Cookies.Add(views); // Lấy List<int> chứa mã hàng đã xem từ cookie var keys = views.Values .AllKeys.Select(k => int.Parse(k)).ToList(); // Truy vấn háng đãn xem ViewBag.Views = db.Products .Where(p => keys.Contains(p.Id)); //Truy vấn sản phẩm bán chạy ViewBag.Top = db.Products .Where(p => p.Id > 0).OrderByDescending(p => p.Views).Take(10).ToList(); return(View(model)); }
public async Task <ActionResult> OnPost(InputModel model) { string ur = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(ur); //if (ModelState.IsValid) //{ var client = new HttpClient(); var AuthyAPIKey = "E09FjK58eXC4oLAovzH9VBxFGzcAlobB"; // Add authentication header client.DefaultRequestHeaders.Add("X-Authy-API-Key", AuthyAPIKey); var values = new Dictionary <string, string> { { "via", "sms" }, { "phone_number", model.PhoneNumber }, { "country_code", model.DialingCode }, }; var content = new FormUrlEncodedContent(values); var url = $"https://api.authy.com/protected/json/phones/verification/start?api_key=" + AuthyAPIKey; HttpResponseMessage response = await client.PostAsync(url, content); if (response.IsSuccessStatusCode) { return(View(model)); } else { return(RedirectToAction("SecondView", "VerifyPhone")); } }
public async Task <ActionResult> Register(Customer model) { string url = "https://vnexpress.net/rss/giai-tri.rss"; ViewBag.listItems = RSSHelper.read(url); //if (!XCaptcha.IsValid) //{ // ModelState.AddModelError("", "Invalid security code !"); // return View(model); //} if (ModelState.IsValid) { var user = new ApplicationUser() { UserName = model.Id }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { db.Customers.Add(model); db.SaveChanges(); await SignInAsync(user, isPersistent : false); return(RedirectToAction("Index", "Home")); } else { AddErrors(result); } } // If we got this far, something failed, redisplay form return(View(model)); }