public void OnPostUpdate(Item item) { using (Shopping_listDataContext _sl = new Shopping_listDataContext()) { _sl.Items.Update(item); _sl.SaveChanges(); } }
public void OnPostDelete(Brand brand) { using (Shopping_listDataContext _sl = new Shopping_listDataContext()) { _sl.Brand.Remove(brand); _sl.SaveChanges(); } }
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(); } }
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()); }
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(); } }
public static IQueryable <Item> GetItems() { Shopping_listDataContext _sl = new Shopping_listDataContext(); return(_sl.Items); }
public static IQueryable <Brand> GetBrands() { Shopping_listDataContext _sl = new Shopping_listDataContext(); return(_sl.Brand); }