public CheckoutSummaryDTO GetCheckoutSummary(int newOrderId) { var order = _getOrder.GetById(newOrderId); var customer = _getCustomer.GetById(order.CustomerId); var orderItems = _getOrderItems.Get(newOrderId).Select(oi => new OrderItemDTO() { Quantity = oi.Quantity, Description = oi.Description, Price = oi.Price, ProductId = oi.ProductId, Status = oi.Status, OrderId = oi.OrderId }); return(new CheckoutSummaryDTO { OrderNumber = newOrderId.ToString("000000000"), DeliveryUpToNWorkingDays = 4, Total = order.TotalPrice, CustomerInfo = CustomerDTO.FromCustomer(customer), DeliveryAddress = _getCustomerAddress.GetCustomerAddressById(order.DeliveryAddressId), PaymentOption = _getPaymentOption.GetPaymentOptionById(order.PaymentOptionId), OrderItems = orderItems }); }
public ActionResult SavePaymentOption(PaymentOptionDTO paymentOption) { if (!ValidatePaymentOption(paymentOption)) { return(View("AddPaymentOption", paymentOption)); } _savePaymentOption.Save(paymentOption); var customer = CustomerDTO.FromCustomer(_getCustomer.GetById(paymentOption.CustomerId)); return(View("ManageAccount", customer)); }
public ActionResult RemoveAddress(int addressid) { var address = CustomerAddress.FromDto(_getCustomerAddress.GetCustomerAddressById(addressid)); var customerId = address.CustomerId; _deleteCustomerAddress.Delete(address); var customerDTO = CustomerDTO.FromCustomer(_getCustomer.GetById(customerId)); return(View("ManageAccount", customerDTO)); }
public ActionResult SaveAccount(CustomerDTO accountDetails) { var customer = _getCustomer.GetById(Identity.LoggedInUserId); customer.Title = accountDetails.Title; customer.ForeName = accountDetails.ForeName; customer.Surname = accountDetails.Surname; customer.Email = accountDetails.Email; customer.Telephone = accountDetails.Telephone; _saveCustomer.SaveAccountDetails(CustomerDTO.FromCustomer(customer)); return(RedirectToAction("Index", "Home")); }
public CheckoutConfirmDetailsDTO GetCheckoutConfirmDetails() { var cart = _getCart.Get(Identity.LoggedInUserId); return(new CheckoutConfirmDetailsDTO { CustomerInfo = CustomerDTO.FromCustomer(_getCustomer.GetById(cart.CustomerId)), CartItems = cart.CartItems, DeliveryAddressId = 0, PaymentOptionId = 0, Total = cart.Total }); }
public ActionResult SaveAddress(CustomerAddressDTO address) { if (!ValidateAddress(address)) { if (address.Id > 0) { return(View("EditAddress", address)); } else { return(View("AddAddress", address)); } } _saveCustomerAddress.Save(address); var customer = CustomerDTO.FromCustomer(_getCustomer.GetById(address.CustomerId)); return(View("ManageAccount", customer)); }
public ActionResult ManageAccount() { var customer = _getCustomer.GetById(Identity.LoggedInUserId); return(View(CustomerDTO.FromCustomer(customer))); }
public static string IdentityName() { return(currentCustomer == null ? "" : CustomerDTO.FromCustomer(currentCustomer).DisplayName); }