public EntityReference Create(Entity entity) { Throwers.IfNullArgument(entity, "entity"); var id = this.services.Service.Create(entity); return(new EntityReference(entity.LogicalName, id)); }
public EntityReference RetrievePriceListOrNull(string priceListName) { Throwers.IfNullOrEmptyArgument(priceListName, "priceListName"); var priceListGuid = this.services.Context .CreateQuery <PriceLevel>() .Where(x => x.Name == priceListName) .Select(x => x.Id) .FirstOrDefault(); if (priceListGuid == Guid.Empty) { return(null); } return(new EntityReference(PriceLevel.EntityLogicalName, priceListGuid)); }
public EntityReference CreatePriceList(string priceListName, EntityReference currencyId) { this.services.T.Trace("CreatePriceList..."); Throwers.IfNullOrEmptyArgument(priceListName, "priceListName"); Throwers.IfNullArgument(currencyId, "currencyId"); Throwers.IfReferenceTypeIsWrong(currencyId, TransactionCurrency.EntityLogicalName); var newPriceLevel = new PriceLevel { Name = priceListName, TransactionCurrencyId = currencyId }; var id = this.services.Service.Create(newPriceLevel); this.services.T.Trace("CreatePriceList!"); return(new EntityReference(PriceLevel.EntityLogicalName, id)); }
public void Update(Entity entity) { Throwers.IfNullArgument(entity, "entity"); this.services.Service.Update(entity); }