Exemplo n.º 1
0
 public void OnPostUpdate(Item item)
 {
     using (Shopping_listDataContext _sl = new Shopping_listDataContext())
     {
         _sl.Items.Update(item);
         _sl.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void OnPostDelete(Brand brand)
 {
     using (Shopping_listDataContext _sl = new Shopping_listDataContext())
     {
         _sl.Brand.Remove(brand);
         _sl.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void OnPostInsert(Item item)
 {
     using (Shopping_listDataContext _sl = new Shopping_listDataContext())
     {
         _sl.Items.Add(new Item {
             ItemName = item.ItemName, ItemDescription = item.ItemDescription
         });
         _sl.SaveChanges();
     }
 }
Exemplo n.º 4
0
        public async Task <IActionResult> OnPostDeleteAsync(string ItemId)
        {
            using (Shopping_listDataContext _sl = new Shopping_listDataContext())
            {
                var item = await _sl.Items.FindAsync(ItemId);

                _sl.Items.Remove(item);
                _sl.SaveChanges();
            }

            return(RedirectToPage());
        }
Exemplo n.º 5
0
 public void OnPostInsert(Brand brand)
 {
     using (Shopping_listDataContext _sl = new Shopping_listDataContext())
     {
         _sl.Brand.Add(new Brand {
             BrandName    = brand.BrandName,
             BrandNotes   = brand.BrandNotes,
             BrandWebsite = brand.BrandWebsite
         });
         _sl.SaveChanges();
     }
 }
Exemplo n.º 6
0
        public static IQueryable <Item> GetItems()
        {
            Shopping_listDataContext _sl = new Shopping_listDataContext();

            return(_sl.Items);
        }
Exemplo n.º 7
0
        public static IQueryable <Brand> GetBrands()
        {
            Shopping_listDataContext _sl = new Shopping_listDataContext();

            return(_sl.Brand);
        }