public void SaveDrive(Drive drive) { if (drive.DriveId == 0) { context.Drives.Add(drive); } else { Drive dbEntry = context.Drives.FirstOrDefault(d => d.DriveId == drive.DriveId); if (dbEntry != null) { dbEntry.Manufacturer = drive.Manufacturer; dbEntry.Model = drive.Model; dbEntry.Interface = drive.Interface; dbEntry.SizeInGB = drive.SizeInGB; dbEntry.TransferProtocol = drive.TransferProtocol; } } context.SaveChanges(); }
public override void RemoveLine(Drive drive) { base.RemoveLine(drive); Session.SetJson("Cart", this); }
public virtual void RemoveLine(Drive Drive) => lineCollection.RemoveAll(l => l.Drive.DriveId == Drive.DriveId);
public override void AddItem(Drive drive, int quantity) { base.AddItem(drive, quantity); Session.SetJson("Cart", this); }