public Shop_Item AddItem(Shop_Item SI) { try { using (shoponlineDataContext context = DbUtils.Create()) { context.Shop_Items.InsertOnSubmit(SI); context.SubmitChanges(); return SI; } } catch (Exception) { return null; } }
public Shop_Item UpdateShopItem(Shop_Item s_item) { try { using (shoponlineDataContext context = DbUtils.Create()) { Shop_Item itemObj = context.Shop_Items.Where(u => u.ItemId.Equals(s_item.ItemId)).SingleOrDefault(); if (itemObj != null) { itemObj.User_Id = s_item.User_Id; itemObj.ItemName = s_item.ItemName; itemObj.ItemCompany = s_item.ItemCompany; itemObj.ItemBrand = s_item.ItemBrand; itemObj.ItemPrice = s_item.ItemPrice; itemObj.IsActive = s_item.IsActive; context.SubmitChanges(); return itemObj; } } } catch (Exception) { } return null; }