public ActionResult checkoutPayment(CategoryProductViewModels values) { var order = new Order(); TryUpdateModel(order); try { var cart = ShoppingCart.GetCart(this.HttpContext); order = values.Order; order.UserName = User.Identity.Name; order.OrderDate = DateTime.Now; order.Total = cart.GetTotal(); //string[] args = { "E-Ticaret", "İyi günlerde kullanın" }; //Main(args); //Save Order db.Orders.Add(order); db.SaveChanges(); //Process the order cart.CreateOrder(order); return(RedirectToAction("Complete", "Home", new { id = order.OrderId })); } catch { //Invalid - redisplay with errors return(View(order)); } }
public ActionResult IndexId(int id) { //int id1 = Convert.ToInt32(id); //return RedirectToAction("Index1", "Categories"); var result = (from p in db.Products where p.CategoryId == id select new CategoryProductViewModels { Product = db.Products.ToList(), Category = db.Categories.ToList() //CategoryId = c.CategoryName, //Price = p.Price, //ProductId = p.ProductId, //ProductionDate = p.ProductionDate, //ProductUrl = p.ProductUrl, //SKT = p.SKT, //TETT = p.TETT, //Title = p.Title, //User = p.User }); CategoryProductViewModels son = new CategoryProductViewModels { Product = db.Products.Where(x => x.CategoryId == id).ToList(), Category = db.Categories.ToList() }; return(View(son)); }
public ActionResult Index2() { //return RedirectToAction("Index1", "Categories"); //var result = (from p in db.Products // select new ProductsViewModels // { // Price= p.Price, // ProductId=p.ProductId, // ProductionDate= p.ProductionDate, // ProductUrl=p.ProductUrl, // SKT=p.SKT, // TETT=p.TETT, // Title=p.Title, // User=p.User // }).ToList(); var son = new CategoryProductViewModels { Product = db.Products.ToList(), Category = db.Categories.ToList() }; return(View(son)); }
public async Task <ActionResult> Login(CategoryProductViewModels model, string returnUrl) { if (!ModelState.IsValid) { return(View(model)); } // This doesn't count login failures towards account lockout // To enable password failures to trigger account lockout, change to shouldLockout: true var result = await SignInManager.PasswordSignInAsync(model.LoginViewModel.Email, model.LoginViewModel.Password, model.LoginViewModel.RememberMe, shouldLockout : false); switch (result) { case SignInStatus.Success: return(RedirectToLocal(returnUrl)); case SignInStatus.LockedOut: return(View("Lockout")); case SignInStatus.RequiresVerification: return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.LoginViewModel.RememberMe })); case SignInStatus.Failure: default: ModelState.AddModelError("", "Invalid login attempt."); return(View(model)); } }
public ActionResult Index() { //return RedirectToAction("Index1", "Categories"); var son = new CategoryProductViewModels { Product = db.Products.ToList(), Category = db.Categories.ToList() }; return(View(son)); }
public ActionResult checkout() { //return RedirectToAction("Index1", "Categories"); var cart = ShoppingCart.GetCart(this.HttpContext); var son = new CategoryProductViewModels { Cart = cart.GetCartItems(), Product = db.Products.ToList(), Category = db.Categories.ToList(), Total = cart.GetTotal() }; return(View(son)); }
public ActionResult single(int id) { //int id = Convert.ToInt32(product.Product.FirstOrDefault().ProductId); //var cart = ShoppingCart.GetCart(this.HttpContext); Product pro = db.Products.Find(id); var son = new CategoryProductViewModels { Products = pro, Category = db.Categories.ToList() }; return(View(son)); }
public async Task <ActionResult> Register(CategoryProductViewModels model) { ApplicationDbContext db = new ApplicationDbContext(); var RoleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(db)); if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.RegisterViewModel.Email, Email = model.RegisterViewModel.Email }; var result = await UserManager.CreateAsync(user, model.RegisterViewModel.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); if (!RoleManager.RoleExists("Admin")) { var role = new IdentityRole(); role.Name = "Admin"; RoleManager.Create(role); } // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); await this.UserManager.AddToRoleAsync(user.Id, "Admin"); return(RedirectToAction("Index1", "Categories")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }