public void DeleteSku(string orpSkuName) { using (var ctx = new SkuInventoryEntities()) { var foundSku = getSkuInventoryRecord(ctx, orpSkuName); if (foundSku == null) { return; } ctx.SkuInventoryDbs.Remove(foundSku); ctx.SaveChanges(); } }
public void UpdateSku(string orpSkuName, OrpSku updatedOrpSku) { using (var ctx = new SkuInventoryEntities()) { var foundSku = getSkuInventoryRecord(ctx, orpSkuName); if (foundSku == null) { return; } foundSku.ID = updatedOrpSku.OrpSkuId; foundSku.Item_Description = updatedOrpSku.OrpSkuDescription; foundSku.Item_Number = updatedOrpSku.OrpSkuName; foundSku.InUse = updatedOrpSku.InUse.ToString(); foundSku.Term = updatedOrpSku.Term; foundSku.Product = updatedOrpSku.Product; foundSku.SkuPrice = (decimal?)updatedOrpSku.SkuPrice; foundSku.MsrpPrice = (decimal?)updatedOrpSku.MsrpPrice; foundSku.Comment = updatedOrpSku.Comment; ctx.SaveChanges(); } }
public void AddSku(OrpSku newOrpSku) { using (var ctx = new SkuInventoryEntities()) { if (getSkuInventoryRecord(ctx, newOrpSku.OrpSkuName) != null) { return; } var orpSku = new SkuInventoryDb() { ID = newOrpSku.OrpSkuId, Item_Description = newOrpSku.OrpSkuDescription, Item_Number = newOrpSku.OrpSkuName, InUse = newOrpSku.InUse.ToString(), Term = newOrpSku.Term, Product = newOrpSku.Product, SkuPrice = (decimal?)newOrpSku.SkuPrice, MsrpPrice = (decimal?)newOrpSku.MsrpPrice, }; ctx.SkuInventoryDbs.Add(orpSku); ctx.SaveChanges(); } }