public bool Put(Supplier item) { if (item == null) { return(false); } Supplier existingItem = _context.Supplier.FirstOrDefault(s => s.SupplierId == item.SupplierId); if (existingItem != null) { existingItem.SupplierName = item.SupplierName; existingItem.IsCrest = item.IsCrest; _context.Supplier.Update(existingItem); } else { _context.Supplier.Add(item); } _context.SaveChanges(); return(true); }
public bool Put(SoW item) { if (item == null) { return(false); } SoW existingItem = _context.SoW.FirstOrDefault(s => s.SoWid == item.SoWid); if (existingItem != null) { existingItem.SupplierId = item.SupplierId; existingItem.ServiceLine = item.ServiceLine; existingItem.ContractId = item.ContractId; existingItem.EffectiveDate = item.EffectiveDate; existingItem.ExpirationDate = item.ExpirationDate; existingItem.Msowner = item.Msowner; existingItem.InfyOwner = item.InfyOwner; existingItem.ServiceCatalogVersion = item.ServiceCatalogVersion; existingItem.PonumYear1 = item.PonumYear1; existingItem.SowamountYear1 = item.SowamountYear1; existingItem.SowamountYear2 = item.SowamountYear2; existingItem.SowamountYear3 = item.SowamountYear3; existingItem.SowamountYear4 = item.SowamountYear4; existingItem.IsCrest = item.IsCrest; existingItem.Remarks = item.Remarks; _context.SoW.Update(existingItem); } else { _context.SoW.Add(item); } _context.SaveChanges(); return(true); }