Beispiel #1
0
        public ActionResult ChangeGrades(GradesViewModel vm)
        {
            if (Request.Form["btnSave"] != null)
            {
                var           spContext     = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
                SampleProcess sampleProcess = new SampleProcess();
                vm.spHostURL   = spContext.SPHostUrl.AbsoluteUri;
                vm.accessToken = spContext.UserAccessTokenForSPHost;
                sampleProcess.SamplePost(vm);

                return(View(sampleProcess.GetSampleGetMyLogin(vm)));
            }
            else
            {
                var        spContext  = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
                TokenModel tokenModel = new TokenModel();
                vm.spHostURL   = spContext.SPHostUrl.AbsoluteUri;
                vm.accessToken = spContext.UserAccessTokenForSPHost;

                SampleProcess sampleProcess = new SampleProcess();
                /*string name = */ //sampleProcess.GetSampleGetMyLogin(vm);
                //iewBag.Name = name;

                //return View(vm);
                return(View(sampleProcess.GetSampleGetMyLogin(vm)));
            }
        }
        public ActionResult GetMyLogin()
        {
            var        spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
            TokenModel vm        = new TokenModel();

            vm.spHostURL   = spContext.SPHostUrl.AbsoluteUri;
            vm.accessToken = spContext.UserAccessTokenForSPHost;

            SampleProcess sampleProcess = new SampleProcess();
            string        name          = sampleProcess.GetSampleGetMyLogin(vm);

            ViewBag.Name = name;
            return(View(vm));
        }
        public ActionResult Index(GradesViewModel vm)
        {
            var           spContext     = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
            SampleProcess sampleProcess = new SampleProcess();

            vm.Grade.CourseTitle = "GGG6666 Good Games Galore";
            vm.Grade.Passed      = "Fail";
            vm.spHostURL         = spContext.SPHostUrl.AbsoluteUri;
            vm.accessToken       = spContext.UserAccessTokenForSPHost;
            vm = sampleProcess.SamplePost(vm);


            return(View(vm));
        }
Beispiel #4
0
        public void Test_AppHost_IHostedService()
        {
            var hostedProcess = new SampleProcess()
            {
                Name = "Process1"
            };
            var hostedProcess2 = new SampleProcess()
            {
                Name = "Process2"
            };
            var hostedService = new SampleService()
            {
                Name = "Service1"
            };
            var hostedService2 = new SampleService()
            {
                Name = "Service2"
            };

            var hostBuilder = new AppHostBuilder().CreateDefaultBuilder();

            hostBuilder.AddHostedProcess(hostedProcess);
            hostBuilder.AddHostedProcess(hostedProcess2);
            hostBuilder.AddHostedProcess <SampleProcess>();
            hostBuilder.AddHostedService(hostedService);
            hostBuilder.AddHostedService(hostedService2);
            hostBuilder.AddHostedService <SampleService>();
            var host = hostBuilder.Build();

            host.RunOnce();

            //hostedProcess.StartCalls.Should().Be(1);
            //hostedProcess.StopCalls.Should().Be(1);
            //hostedProcess.ErrorCalls.Should().Be(1);
            //hostedService.StartCalls.Should().Be(1);
            //hostedService.StopCalls.Should().Be(1);
        }