/// <summary>
        /// ajax get to load the content
        /// </summary>
        /// <returns></returns>
        public ActionResult Step5Summary()
        {
            //using service to get the userss
            IWizardService service  = new WizardServices();
            var            getUsers = service.GetUsers();

            var model = new WizardViewModel()
            {
                Users = getUsers
            };


            return(PartialView(model));
        }
        public void WizardServicesTest()
        {
            IWizardService service = new WizardServices();

            var org = new Organisation()
            {
                OrganisationName = "testOrg",
                UserName         = "******",
                Password         = "******",
                Address          = "111 test st, sydney, nsw, 2000",
                Country          = CountryType.Australia,
                Contact          = "1111111111"
            };

            org.Users = new List <User>
            {
                new User {
                    FirstName = "PFName", LastName = "PLName", Email = "*****@*****.**", Contact = "111"
                },
                new User {
                    FirstName = "SFName", LastName = "SLName", Email = "*****@*****.**", Contact = "222"
                },
            };

            org.Questionnaire = new Questionnaire()
            {
                FrontendTech = "CSS",
                HearFrom     = "facebook",
                IsJave       = false,
                IsChinese    = false,
                IsCSharp     = true,
                HtmlVersion  = 5,
                Comment      = "TEST"
            };


            try
            {
                service.SaveWizard(org);
            }
            catch (Exception e)
            {
                Assert.Fail();
            }
        }
示例#3
0
        public void Step5Summary()
        {
            HomeController controller = new HomeController();

            ViewResult result = controller.Step5Summary() as ViewResult;

            var model = result.ViewData.Model; //need to cast some values here

            IWizardService service  = new WizardServices();
            var            getUsers = service.GetUsers();


            var modelView = new WizardViewModel()
            {
                Users = getUsers
            };

            //check if the user is empty
            Assert.AreEqual(true, getUsers.Count == 0);
        }
        public JsonResult SaveSteps(WizardViewModel model)
        {
            var organisation = model.Organisation;

            //convert the ef relationship
            organisation.Questionnaire = model.Questionnaire;
            if (organisation.Questionnaire.HtmlVersion == null)
            {
                organisation.Questionnaire.HtmlVersion = 0;
            }
            model.PrimaryUser.Organisation   = organisation;
            model.SecondaryUser.Organisation = organisation;
            organisation.Users = new List <User>()
            {
                model.PrimaryUser, model.SecondaryUser
            };


            IWizardService service = new WizardServices();

            service.SaveWizard(organisation);

            return(Json(new { success = true }));
        }