// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, webshopContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "areaRoute", template: "{area:exists}/{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "default", template: "{controller=WebShop}/{action=List}/{id?}"); }); DBInitializer.Initialize(context); }
public void Post([FromBody] Bolt ujelem) { webshopContext context = new webshopContext(); context.Bolts.Add(ujelem); context.SaveChanges(); }
public int M3() { webshopContext context = new webshopContext(); int adatokSzama = context.Bolts.Count(); return(adatokSzama); }
//listázza az összes rekordot public ActionResult M1() { webshopContext context = new webshopContext(); var adatok = from x in context.Bolts select x; return(new JsonResult(adatok)); }
public ActionResult M2(int sorszam) { webshopContext context = new webshopContext(); var adat = (from x in context.Bolts where x.SorszamSk == sorszam select x); if (adat == null) { return(BadRequest("Nincs ilyen sorszámú adat")); } return(new JsonResult(adat)); }
public string M5(int sorszam) { webshopContext context = new webshopContext(); var adat = (from x in context.Bolts where x.SorszamSk == sorszam select x).FirstOrDefault(); if (adat == null) { return("Nincs ilyen sorszámú adat"); } context.Bolts.Remove(adat); context.SaveChanges(); return("sikerült"); }
public WebshopController(webshopContext context) { _context = context; }
public ShoppingItemsController(webshopContext context) { _context = context; }
public CustomersController(webshopContext context) { _context = context; }
public ProductsController(webshopContext context) { _context = context; }