示例#1
0
        public ActionResult EditMembershipLevel(Guid id)
        {
            using (UnitOfWorkManager.NewUnitOfWork())
            {
                var membershipLevel     = _membershipLevelService.GetById(id);
                var membershipLevelList = _membershipLevelService.GetAllMembershipLevels();
                var listViewModel       = new MembershipLevelListViewModel
                {
                    NonPagedMembershipLevels = membershipLevelList.ToList()
                };

                var viewModel = new MembershipLevelViewModel
                {
                    MembershipLevelId   = membershipLevel.Id,
                    EditName            = membershipLevel.Name,
                    EditDescription     = membershipLevel.Description,
                    EditEmployeeMax     = membershipLevel.EmployeeMax,
                    EditAnnualPrice     = membershipLevel.AnnualPrice,
                    EditSemiAnnualPrice = membershipLevel.SemiAnnualPrice,
                    _listViewModel      = listViewModel
                };
                return(View(viewModel));
            }
        }
示例#2
0
        public ActionResult UpdateBusiness(Guid id)
        {
            using (UnitOfWorkManager.NewUnitOfWork())
            {
                var business = _businessService.Get(id);
                if (business != null)
                {
                    var loggedOnUserId      = LoggedOnReadOnlyUser?.Id ?? Guid.Empty;
                    var settings            = SettingsService.GetSettings();
                    var allMemberships      = MembershipService.GetAll();
                    var allMembersViewModel = allMemberships.Select(ViewModelMapping.UserToSingleMemberListViewModel).ToList();

                    ListBooleanViewModel booleanViewModel = new ListBooleanViewModel()
                    {
                        ListBoolean = SettingsService.ListOfBoolean().ToList()
                    };
                    StatesViewModel statesViewModel = new StatesViewModel()
                    {
                        allStates = SettingsService.ListOfStates().ToList()
                    };
                    AllClassificationsViewModel classificationViewModel = new AllClassificationsViewModel()
                    {
                        allClassifications = _classificationService.GetAllClassifications().ToList()
                    };
                    AllMembershipLevelViewModel membershipLevelViewModel = new AllMembershipLevelViewModel()
                    {
                        allMembershipLevels = _membershipLevelService.GetAllMembershipLevels().ToList()
                    };
                    AllMembersListViewModel membersListViewModel = new AllMembersListViewModel()
                    {
                        AllMembershipUsersList = allMembersViewModel
                    };
                    UpdateBusinessViewModel viewModel = new UpdateBusinessViewModel()
                    {
                        Id                           = business.Id,
                        Name                         = business.Name,
                        MailingAddress               = business.MailingAddress,
                        MailingCity                  = business.MailingCity,
                        MailingState                 = business.MailingState,
                        MailingZipcode               = business.MailingZipcode,
                        PhysicalAddress              = business.PhysicalAddress,
                        PhysicalCity                 = business.PhysicalCity,
                        PhysicalState                = business.PhysicalState,
                        PhysicalZipcode              = business.PhysicalZipcode,
                        Active                       = business.Active,
                        Completed                    = business.Completed,
                        Description                  = business.Description,
                        Avatar                       = business.Avatar,
                        Phone                        = business.Phone,
                        WebAddress                   = business.WebAddress,
                        _booleanViewModel            = booleanViewModel,
                        _stateViewModel              = statesViewModel,
                        _allClassificationsViewModel = classificationViewModel,
                        _allMembershipLevelViewModel = membershipLevelViewModel,
                        _allMembersListViewModel     = membersListViewModel
                    };
                    if (business.Classification != null)
                    {
                        viewModel.Classification_Id = business.Classification.Id;
                    }
                    if (business.MembershipLevel != null)
                    {
                        viewModel.MembershipLevel_Id = business.MembershipLevel.Id;
                    }
                    if (business.User != null)
                    {
                        viewModel.MembershipUser_Id = business.User.Id;
                    }
                    return(View(viewModel));
                }
                TempData[AppConstants.MessageViewBagName] = new AdminGenericMessageViewModel
                {
                    Message     = "Loading the business information failed.  Try again or contact Administrator.",
                    MessageType = GenericMessages.success
                };
                return(RedirectToAction("Index", "Admin", new { area = "Admin" }));
            }
        }