コード例 #1
0
        public MemberPcp DeleteMembership(long memberPk)
        {
            MemberPcp dbEntry = context.PcfmembersPcpassigmentDev.FirstOrDefault(m => m.Pk == memberPk);

            if (dbEntry != null)
            {
                context.PcfmembersPcpassigmentDev.Remove(dbEntry);
                context.SaveChanges();
            }
            return(dbEntry);
        }
コード例 #2
0
        public void SaveMembership(MemberPcp memberPcp)
        {
            if (memberPcp.Pk == 0)
            {
                context.Add(memberPcp);
            }
            else
            {
                MemberPcp dbEntry = context.PcfmembersPcpassigmentDev.FirstOrDefault(p => p.Pk == memberPcp.Pk);

                if (dbEntry != null)
                {
                    dbEntry.MemberId    = memberPcp.MemberId;
                    dbEntry.MemberName  = memberPcp.MemberName;
                    dbEntry.PcpgrpTaxId = memberPcp.PcpgrpTaxId;
                    dbEntry.PcpgrpName  = memberPcp.PcpgrpName;
                    dbEntry.PcpNpi      = memberPcp.PcpNpi;
                    dbEntry.PcpName     = memberPcp.PcpName;
                }
            }
            context.SaveChanges();
        }