// // GET: /Administrator/Customer/Edit/5 public ActionResult Edit(int id) { try { vm.Customer = repositoryUser.getItem(id); vm.CustomerAttr = vm.Customer.Fly_CustomerAttribute.Single(x => x.CustomerId.Equals(id)); vm.CustomerAvatar = vm.Customer.Fly_Picture; //vm.MappingRole = vm.Customer.Fly_Customer_CustomerRole_Mapping.Where(x => x.CustomerID.Equals(id)).FirstOrDefault(); vm.ListCustomerRole = repositoryUserRole.getAllItems().Where(x => x.Active == true).ToList(); //vm.CustomerProductPrice = vm.CustomerRole.Fly_CustomerRole_ProductPrice.Where(x => x.CustomerRoleID.Equals(vm.CustomerRole.CustomerRoleID)).FirstOrDefault(); //vm.MappingDiscount = vm.CustomerRole.Fly_CustomerRole_Discount_Mapping.Where(x => x.CustomerRoleID.Equals(vm.CustomerRole.CustomerRoleID)).FirstOrDefault(); ; vm.isActive = vm.Customer.Active.GetValueOrDefault(); vm.isAdmin = vm.Customer.IsAdmin.GetValueOrDefault(); vm.selectItem = vm.CustomerAttr.CountryID.GetValueOrDefault(); vm.PositionCountry = repositoryCountry.getAllItems().Select( x => new SelectListItem { Value = x.CountryID.ToString(), Text = x.Name }); return(View(vm)); } catch (Exception ex) { return(View(ex.Message)); } }
// // GET: /Administrator/Customer/Edit/5 public ActionResult Edit(int id) { try { _vm.Customer = _repositoryUser.getItem(id); if (_vm.Customer != null) { _vm.CustomerAttr = _vm.Customer.Fly_CustomerAttribute.FirstOrDefault(x => x.CustomerId.Equals(id)); _vm.CustomerAvatar = _vm.Customer.Fly_Picture; //vm.MappingRole = vm.Customer.Fly_Customer_CustomerRole_Mapping.Where(x => x.CustomerID.Equals(id)).FirstOrDefault(); _vm.ListCustomerRole = _repositoryUserRole.getAllItems().Where(x => x.Active == true).ToList(); foreach (var valuemp in _vm.ListCustomerRole) { foreach (var cusmpRole in _vm.Customer.Fly_Customer_CustomerRole_Mapping) { if (valuemp.CustomerRoleID.Equals(cusmpRole.CustomerRoleID)) { valuemp.Selected = true; } } } //vm.CustomerProductPrice = vm.CustomerRole.Fly_CustomerRole_ProductPrice.Where(x => x.CustomerRoleID.Equals(vm.CustomerRole.CustomerRoleID)).FirstOrDefault(); //vm.MappingDiscount = vm.CustomerRole.Fly_CustomerRole_Discount_Mapping.Where(x => x.CustomerRoleID.Equals(vm.CustomerRole.CustomerRoleID)).FirstOrDefault(); ; _vm.isActive = _vm.Customer.Active.GetValueOrDefault(); _vm.isAdmin = _vm.Customer.IsAdmin.GetValueOrDefault(); } if (_vm.CustomerAttr != null) { _vm.selectItem = _vm.CustomerAttr.CountryID.GetValueOrDefault(); } if (_repositoryCountry != null) { _vm.PositionCountry = _repositoryCountry.getAllItems().Select( x => new SelectListItem { Value = x.CountryID.ToString(), Text = x.Name }); } return(View(_vm)); } catch (Exception ex) { return(View(ex.Message)); } }
// // GET: /Payment/ public ActionResult Index(int cusId, int productId) { _vm.Customer = _repositoryUser.getItem(cusId); if (_vm.Customer.Fly_CustomerAttribute != null && _vm.Customer.Fly_CustomerAttribute.Count > 0) { _vm.CustomerAttr = _vm.Customer.Fly_CustomerAttribute.Single(x => x.CustomerId.Equals(_vm.Customer.CustomerID)); } _vm.Products = _reposProduct.getItem(productId); _vm.ProductVariant = _vm.Products.Fly_ProductVariant.Single(x => x.ProductID.Equals(_vm.Products.ProductId)); _vm.Order = new Fly_Order { OrderTotal = _vm.ProductVariant.Price }; _vm.ListCountryItems = _repositoryCountry.getAllItems().Select( x => new SelectListItem { Value = x.CountryID.ToString(), Text = x.Name }); _vm.SelectIndexCountry = 229; // default choose Vietnamese _vm.ListShippingItems = _repositryShipping.getAllItems().Select( x => new SelectListItem { Value = x.ShippingMethodID.ToString(), Text = x.Name }); _vm.ListPaymentMethodItems = _repositryPaymentMethod.getAllItems().Select( x => new SelectListItem { Value = x.VisibleName, Text = x.VisibleName }); return(View(_vm)); }