/// <summary>
 /// Deprecated Method for adding a new object to the tblInventoryLocation EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblInventoryLocation(InventoryLocation inventoryLocation)
 {
     base.AddObject("tblInventoryLocation", inventoryLocation);
 }
 /// <summary>
 /// Create a new InventoryLocation object.
 /// </summary>
 /// <param name="rowId">Initial value of the RowId property.</param>
 /// <param name="locationId">Initial value of the LocationId property.</param>
 /// <param name="locationName">Initial value of the LocationName property.</param>
 public static InventoryLocation CreateInventoryLocation(global::System.Int32 rowId, global::System.Guid locationId, global::System.String locationName)
 {
     InventoryLocation inventoryLocation = new InventoryLocation();
     inventoryLocation.RowId = rowId;
     inventoryLocation.LocationId = locationId;
     inventoryLocation.LocationName = locationName;
     return inventoryLocation;
 }
        public bool Save(LocationDto location)
        {
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }

            var entityItem =
                _entities.tblInventoryLocation.Where(i => i.LocationId == location.Id).SingleOrDefault();

            if (entityItem == null)
            {
                entityItem = new InventoryLocation { LocationId = location.Id };
                _entities.tblInventoryLocation.AddObject(entityItem);
            }

            entityItem.LocationName = location.Name;

            _entities.SaveChanges();

            EntityCache.Locations.Add(location);

            return true;
        }