/// <summary> /// Updates itemList and database /// </summary> /// <param name="pKey"></param> /// <param name="ItemDesc"></param> /// <param name="cost"></param> /// <returns>Null if pKey isn't found or Item if pKey is found</returns> public Item UpdateItem(string pKey, string ItemDesc, double cost) { try { if (dbLink.UpdateItem(pKey, ItemDesc, cost) == -1) { return(null); } foreach (Item item in itemList) { if (item.ItemCode == pKey) { item.ItemDesc = ItemDesc; item.ItemCost = cost; return(item); } } return(null); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
/// <summary> /// this is updating item /// </summary> /// <param name="item"></param> public void UpdateItem(ItemDescription item) { _sql.UpdateItem(item); }