public ActionResult Checkout(UserCheckoutModel model) { Random rnd = new Random(); model.order_number = GenerateRandomInt(rnd); model.user_id = userRepo.GetUserId(User.Identity.Name); model.cart_id = cartRepo.getCartId(model.user_id); model.total_prise = photorepo.totalPrise(User.Identity.Name); int i = cartRepo.CheckOut(model); if (i >= 1) { cartRepo.DeleteAllCartItem(model.user_id); return(RedirectToAction("CheckoutDetail")); } else { return(RedirectToAction("Index")); } }