Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseCors("CorsPolicy");
            app.UseSignalR(routes =>
            {
                routes.MapHub <VendingHub>("/vendinghub");
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            Program.VendingMachine = Machine.StartMachine();
        }
Example #2
0
        /// <summary>
        /// Reset the machine with base value. Communicates the updated machine object back to the user
        /// </summary>
        /// <returns></returns>
        public async Task Restock()
        {
            Program.VendingMachine = Machine.StartMachine();

            await SendMessage();
        }