public void AddSimcha(Simcha simcha) { using (var context = new SimchaDataContext(_connectionString)) { context.Simchas.InsertOnSubmit(simcha); context.SubmitChanges(); } }
private void SetSimchaTotals(Simcha simcha) { using (var context = new ContributionDataContext(_connectionString)) { simcha.Total = context.Contributions.Any(c => c.SimchaId == simcha.Id) ? context.Contributions.Where(c => c.SimchaId == simcha.Id).Select(c => c.Amount).Sum() : 0; simcha.ContributorAmount = context.Contributions.Any(c => c.SimchaId == simcha.Id) ? context.Contributions.Count(c => c.SimchaId == simcha.Id) : 0; } }
partial void DeleteSimcha(Simcha instance);
partial void UpdateSimcha(Simcha instance);
partial void InsertSimcha(Simcha instance);