Пример #1
0
        public ActionResult Shipping()
        {
            CustomerProfileModel profile = customerProfiles.FindByUserId(User.Identity.GetUserId());

            if (profile == null)
            {
                // Create a new profile if none exists
                profile        = new CustomerProfileModel();
                profile.UserId = User.Identity.GetUserId();
                customerProfiles.Add(profile);
            }
            return(View(profile));
        }
Пример #2
0
        public PartialViewResult GetPartialCustomers()
        {
            Session["adminpage"] = "Customers";
            var users = roleManager.FindByName("Customer").Users;
            ICollection <AdminUserViewModel> model = new List <AdminUserViewModel>();

            foreach (var user in users)
            {
                AdminUserViewModel item = new AdminUserViewModel();
                item.User    = context.Users.SingleOrDefault(x => x.Id == user.UserId);
                item.Address = profiles.FindByUserId(item.User.Id);
                item.Orders  = purchases.FindByUserId(item.User.Id).ToList();
                model.Add(item);
            }

            return(PartialView("_AdminCustomers", model));
        }
        public PartialViewResult GetPartialAddress()
        {
            Session["customerpage"] = "Address";
            CustomerProfileModel model = profiles.FindByUserId(User.Identity.GetUserId());

            if (model == null)
            {
                model        = new CustomerProfileModel();
                model.UserId = User.Identity.GetUserId();
                profiles.Add(model);
            }
            return(PartialView("_CustomerAddress", model));
        }