/// <summary> /// Deprecated Method for adding a new object to the tblInventorySupplier EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotblInventorySupplier(InventorySupplier inventorySupplier) { base.AddObject("tblInventorySupplier", inventorySupplier); }
/// <summary> /// Create a new InventorySupplier object. /// </summary> /// <param name="rowId">Initial value of the RowId property.</param> /// <param name="supplierId">Initial value of the SupplierId property.</param> /// <param name="supplierName">Initial value of the SupplierName property.</param> public static InventorySupplier CreateInventorySupplier(global::System.Int32 rowId, global::System.Guid supplierId, global::System.String supplierName) { InventorySupplier inventorySupplier = new InventorySupplier(); inventorySupplier.RowId = rowId; inventorySupplier.SupplierId = supplierId; inventorySupplier.SupplierName = supplierName; return inventorySupplier; }
public bool Save(SupplierDto supplier) { if (supplier == null) { throw new ArgumentNullException("supplier"); } var entityItem = _entities.tblInventorySupplier.Where(i => i.SupplierId == supplier.Id).SingleOrDefault(); if (entityItem == null) { entityItem = new InventorySupplier{SupplierId = supplier.Id}; _entities.tblInventorySupplier.AddObject(entityItem); } entityItem.SupplierName = supplier.Name; entityItem.Website = supplier.Website; _entities.SaveChanges(); EntityCache.Suppliers.Add(supplier); return true; }