Ejemplo n.º 1
0
        public ActionResult ScheduleJob()
        {
            var model = new AddJobViewModel();

            //Populate list box for displaying Service Type selection
            LogicService cmLogic = new LogicService();

            List <SelectListItem> clientSelection = new List <SelectListItem>();
            var clientOptions = cmLogic.GetClientsForUser(User.Identity.GetUserId());

            foreach (ClientDTO c in clientOptions)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = c.Name, Value = c.Name
                };
                clientSelection.Add(selectItem);
            }
            model.JobOptions.ClientOptions = clientSelection;


            //Populate dropdown for displaying Client selection
            List <SelectListItem> serviceTypeSelection = new List <SelectListItem>();
            var serviceTypeOptions = cmLogic.GetServiceTypes();

            foreach (ServiceTypeDTO st in serviceTypeOptions)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = st.Name, Value = st.Name
                };
                serviceTypeSelection.Add(selectItem);
            }
            model.JobOptions.ServiceTypeOptions = serviceTypeSelection;


            //Return updated view model with selection lists for service types and clients

            return(View(model));
        }