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, 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);
        }
Example #2
0
        public void Post([FromBody] Bolt ujelem)
        {
            webshopContext context = new webshopContext();

            context.Bolts.Add(ujelem);
            context.SaveChanges();
        }
Example #3
0
        public int M3()
        {
            webshopContext context     = new webshopContext();
            int            adatokSzama = context.Bolts.Count();

            return(adatokSzama);
        }
Example #4
0
        //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));
        }
Example #5
0
        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));
        }
Example #6
0
        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;
 }
Example #8
0
 public ShoppingItemsController(webshopContext context)
 {
     _context = context;
 }
 public CustomersController(webshopContext context)
 {
     _context = context;
 }
 public ProductsController(webshopContext context)
 {
     _context = context;
 }