public async Task <ActionResult> ProceedPayment(Checkout_Payment vm) { if (ModelState.IsValid) { //var userManager = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); //var user = await userManager.FindByNameAsync(User.Identity.Name); var cart = GetCart(); var clientInfo = cart.ClientDetails; var step2CheckInputs = cart.ClientDetails.HasEmptyProperties(); if (!step2CheckInputs) { RedirectToAction("Checkout", new { step = 2 }); } cart.UpdatePayment(vm); //update user payment details //user.Payment = vm.Payment; //await userManager.UpdateAsync(user); //make order var order = new Order(); order.Address = cart.ClientDetails.Address; order.Name = string.Format("{0} {1}", clientInfo.FirstName, clientInfo.LastName); order.Phone = clientInfo.Phone; order.OrderStatus = "Не просмотрено"; order.Payment = clientInfo.Payment; order.CreatedAt = DateTime.Now; order.EmailAddress = cart.ClientDetails.Email; order.Delivery = clientInfo.Delivery; order.OrderSum = cart.TotalValue(); order.Sequance = 1; _order.Create(order); foreach (var item in cart.Lines) { _orderItem.Create(item.Product, item.Quantity, order.ID, item.Cloth, item.Color); } /* * YaMoney ya = new YaMoney(); * string url = ya.GetTokenRequestURL(); * Response.Redirect(url); */ cart.Clear(); return(RedirectToAction("Finished", new { orderId = EncryptHelper.Encrypt(order.ID.ToString()) })); } return(RedirectToAction("Index", new { step = 4 })); }
public void UpdatePayment(Checkout_Payment vm) { ClientDetails.Payment = vm.Payment; }