public void CreateSyndicate(string synd_name, string synd_date) { InterpolContext context = new InterpolContext(); Syndicate syn = new Syndicate { syn_name = synd_name, syn_date = synd_date }; context.Syndicates.Add(syn); context.SaveChanges(); }
public void Syndicate_Delete(int synd_id) { InterpolContext context = new InterpolContext(); if (context.PSRelations.Any(c => c.sys_id == synd_id)) { var relation_list = context.PSRelations.Where(c => c.sys_id == synd_id).ToList(); context.PSRelations.RemoveRange(relation_list); context.SaveChanges(); } context.SaveChanges(); Syndicate syndicate = context.Syndicates.Where(c => c.syn_id == synd_id).FirstOrDefault(); context.Syndicates.Remove(syndicate); context.SaveChanges(); }