public async Task <FileResult> Get_Invoice(string id) { var cart = await _shop_repo.Shopping_Cart_Tracking_Get_By_Id(id); var addr = await _addr_repo.Get_By_Id(cart.Shipping_Address_Id); addr.Mobile = string.IsNullOrEmpty(addr.Mobile) ? string.Empty : addr.Mobile.StartsWith("+") ? addr.Mobile : string.Format("+{0}{1}", addr.ISDCode, addr.PhoneNumber); cart.ShippingAddress = addr; var invoice_template = _emailSender.GetMailTemplate(cart, "invoice.cshtml"); var file = Utility.Create_Invoice(invoice_template, cart.Id); return(File(file, "application/pdf", string.Format("{0}.pdf", id))); }
public async Task <IViewComponentResult> InvokeAsync(string id) { var payment = await _pay_repo.Get(); var result = await _shop_repo.Shopping_Cart_Tracking_Get_By_Id(id); if (result != null) { result.Credit_Ratio = payment.Credit_Ratio; } return(View(result)); }
public async Task <IActionResult> Check_Out_Step_One(string id) { ViewBag.TrackingId = id; ViewBag.Payments = await _pay_repo.Get(); ViewData["ReturnUrl"] = string.Format("/check-out-1/{0}", id); var result = await _shop_repo.Shopping_Cart_Tracking_Get_By_Id(id); if (result == null) { return(RedirectToAction("Index", "ShopingCart")); } ViewBag.CartType = result.CartType; if (Request.HttpContext.User.Identity.IsAuthenticated) { return(RedirectToLocal(string.Format("/check-out-2/{0}", id))); } return(View()); }
public async Task <PartialViewResult> Guest_Checkout_Step_Two(GuestViewModel model) { if (ModelState.IsValid) { var g_user = new Guest_User { Cart_Id = model.CartId, Email = model.Email, OTP = model.OTP }; var result = await _guest_repo.Check_Async(g_user); if (result) { //await _guest_repo.Delete_Async(g_user); string name = model.Email.Substring(0, model.Email.IndexOf("@")); var user = new User { Email = model.Email, FirstName = name, EmailVerified = true, Password = model.OTP.ToString() }; var user_result = await _userRepository.RegisterUserAsync(user); var cart = await _shop_repo.Shopping_Cart_Tracking_Get_By_Id(model.CartId); if (user_result.Success) { user = user_result.Data as User; await SignInAsync(user); cart.UserId = user.Id; user_result = await _userRepository.GenerateEmailConfirmationTokenAsync(user.Id); if (user_result.Success) { user = user_result.Data as User; await _userRepository.Email_ConfirmationAsync(user.UserKey, user.SecurityCode); } await _shop_repo.Shopping_Cart_Tracking_Update_By_Id(cart); return(PartialView("_Guest_Checkout_2", model)); } } else { return(PartialView("Info", "Unable to verify your email.")); } } return(PartialView("Info", "Something went wrong. Please try again.")); }