Beispiel #1
0
        public ActionResult Create()
        {
            CreateClientViewModel model = new CreateClientViewModel();
            var allEthnicities          = EthnicityManager.GetAll();
            var allDemographics         = DemographicManager.GetAll();
            var allAbuseTypes           = AbuseTypeManager.GetAll();
            var allCounties             = CountyManager.GetAll();
            var allServiceCounties      = CountyManager.GetInServiceArea();
            var allTypes    = TypeManager.GetAll();
            var allStates   = StateManager.GetAll();
            var allGenders  = GenderManager.GetAll();
            var allStatuses = StatusManager.GetAll();

            var checkBoxListItems          = new List <CheckBoxListItem>();
            var abuseTypeCheckBoxListItems = new List <CheckBoxListItem>();

            model.Ethnicities       = allEthnicities;
            model.CountyOfResidence = allCounties;
            model.CountyOfIncident  = allServiceCounties;
            model.Genders           = allGenders;
            model.Types             = allTypes;
            model.States            = allStates;
            model.Statuses          = allStatuses;

            foreach (var demographic in allDemographics)
            {
                checkBoxListItems.Add(new CheckBoxListItem()
                {
                    ID        = demographic.DemographicId,
                    Display   = demographic.DemographicName,
                    IsChecked = false //On the add view, no genres will be selected by default
                });
            }

            model.Demographics = checkBoxListItems;

            foreach (var abuseType in allAbuseTypes)
            {
                abuseTypeCheckBoxListItems.Add(new CheckBoxListItem()
                {
                    ID        = abuseType.AbuseTypeId,
                    Display   = abuseType.AbuseTypeName,
                    IsChecked = false //On the add view, no genres will be selected by default
                });
            }

            model.AbuseTypes = abuseTypeCheckBoxListItems;

            return(View(model));
        }