Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace TimeSlice
- {
- public class Startup
- {
- public Startup(IConfiguration configuration)
- {
- Configuration = configuration;
- }
- public IConfiguration Configuration { get; }
- // This method gets called by the runtime. Use this method to add services to the container.
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddMvc();
- }
- // 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.UseBrowserLink();
- app.UseDeveloperExceptionPage();
- }
- else
- {
- app.UseExceptionHandler("/Home/Error");
- }
- app.Run(async context =>
- {
- Console.Write("got here");
- String course = "CS3705";
- int user = 8;
- SqlConnection con = new SqlConnection("host;initial catalog = timeslice;user id=timeslice;password=********");
- string query = "Insert into COURSES (courseName, userId) Values ('" + course + "', '" + user + "')";
- SqlCommand comm = new SqlCommand();
- comm.Connection = con;
- comm.CommandType = CommandType.Text;
- comm.CommandText = query;
- con.Open();
- comm.ExecuteNonQuery();
- await context.Response.WriteAsync("Hello");
- });
- app.UseStaticFiles();
- app.UseMvc(routes =>
- {
- routes.MapRoute(
- name: "default",
- template: "{controller=Home}/{action=Index}/{id?}");
- });
- }
- }
- }
Add Comment
Please, Sign In to add comment