public ActionResult Checkout() { GetCustomerRequest customerRequest = new GetCustomerRequest() { CustomerIdentityToken = _formsAuthentication.GetAuthorisationToken() }; GetCustomerResponse customerResponse = _customerService.GetCustomer(customerRequest); CustomerView customerView = customerResponse.Customer; if (customerView.DeliveryAddressBook.Count() > 0) { OrderConfirmationView orderConfirmationView = new OrderConfirmationView(); GetBasketRequest getBasketRequest = new GetBasketRequest() {BasketId = base.GetBasketId()}; GetBasketResponse basketResponse = _basketService.GetBasket(getBasketRequest); orderConfirmationView.Basket = basketResponse.Basket; orderConfirmationView.DeliveryAddresses = customerView.DeliveryAddressBook; return View("ConfirmOrder", orderConfirmationView); } return AddDeliveryAddress(); }
public ActionResult DeliveryAddresses() { GetCustomerRequest customerRequest = new GetCustomerRequest(); customerRequest.CustomerIdentityToken = _formsAuthentication.GetAuthenticationToken(); GetCustomerResponse response = _customerService.GetCustomer(customerRequest); CustomerDetailView customerDetailView = new CustomerDetailView(); customerDetailView.Customer = response.Customer; customerDetailView.BasketSummary = base.GetBasketSummaryView(); return View("DeliveryAddresses", customerDetailView); }
public ActionResult List() { GetCustomerRequest request = new GetCustomerRequest() { CustomerIdentityToken = _formsAuthentication.GetAuthenticationToken(), LoadOrderSummary = true }; GetCustomerResponse response = _customerService.GetCustomer(request); CustomersOrderSummaryView customersOrderSummaryView = new CustomersOrderSummaryView(); customersOrderSummaryView.Orders = response.Orders; customersOrderSummaryView.BasketSummary = base.GetBasketSummaryView(); return View(customersOrderSummaryView); }
public ActionResult EditDeliveryAddress(int deliveryAddressId) { GetCustomerRequest customerRequest = new GetCustomerRequest(); customerRequest.CustomerIdentityToken = _formsAuthentication.GetAuthorisationToken(); GetCustomerResponse response = _customerService.GetCustomer(customerRequest); CustomerDeliveryAddressView deliveryAddressView = new CustomerDeliveryAddressView(); deliveryAddressView.CustomerView = response.Customer; deliveryAddressView.Address = response.Customer.DeliveryAddressBook.Where(d => d.Id == deliveryAddressId).FirstOrDefault(); deliveryAddressView.BasketSummary = base.GetBasketSummaryView(); return View(deliveryAddressView); }
public GetCustomerResponse GetCustomer(GetCustomerRequest request) { GetCustomerResponse response = new GetCustomerResponse(); Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken); if (customer != null) { response.CustomerFound = true; response.Customer = customer.ConvertToCustomerDetailView(); if (request.LoadOrderSummary) response.Orders = customer.Orders.OrderByDescending(o => o.Created).ConvertToOrderSummaryViews(); } else response.CustomerFound = false; return response; }
public ActionResult ReceiveTokenAndLogon(string token, string returnUrl) { User user = _externalAuthenticationService.GetUserDetailsFrom(token); if (user.IsAuthenticated) { _formsAuthentication.SetAuthenticationToken(user.AuthenticationToken); GetCustomerRequest getCustomerRequest = new GetCustomerRequest(); getCustomerRequest.CustomerIdentityToken = user.AuthenticationToken; GetCustomerResponse getCustomerResponse = _customerService.GetCustomer(getCustomerRequest); if (getCustomerResponse.CustomerFound) { return RedirectBasedOn(returnUrl); } else { AccountView accountView = InitializeAccountViewWithIssue(true, "Sorry we could not find your customer account. " + "If you don't have an account with us " + "please register."); accountView.CallBackSettings.ReturnUrl = returnUrl; return View("LogOn", accountView); } } else { AccountView accountView = InitializeAccountViewWithIssue(true, "Sorry we could not log you in." + " Please try again."); accountView.CallBackSettings.ReturnUrl = returnUrl; return View("LogOn", accountView); } }