public void AddSell(string discName, string cashier) { using (DiscContext context = new DiscContext()) { context.Sellings.Add(new Selling { CD = context.CDs.FirstOrDefault(s => s.Name == discName), Seller = context.Sellers.FirstOrDefault(s => s.Name == cashier) }); context.SaveChanges(); } }
private void AddDisc(SellInfo sellInfo, Band band) { using (DiscContext context = new DiscContext()) { context.CDs.Add( new CD { Name = sellInfo.CDName, Cd_Date = sellInfo.Cd_Date, Format = context.Formats.FirstOrDefault(f => f.Name == sellInfo.FormatName), Band = band }); context.SaveChanges(); } }