示例#1
0
        public Account Add(Account entity)
        {
            if (entity.Id > 0) return entity;
            context.Account.AddObject(entity);

            try
            {
                context.SaveChanges();
            }
            catch (OptimisticConcurrencyException e)
            {
                //An optimistic concurrency violation has occurred in the data source.
                throw new ConcurrencyException(e.Message);
            }

            return entity;
        }
示例#2
0
 public Account Update(Account entity)
 {
     return entity;
 }
示例#3
0
 public void Delete(Account entity)
 {
     context.DeleteObject(entity);
 }
示例#4
0
        private void FixupAccount(Account previousValue)
        {
            if (previousValue != null && previousValue.Profile.Contains(this))
            {
                previousValue.Profile.Remove(this);
            }

            if (Account != null)
            {
                if (!Account.Profile.Contains(this))
                {
                    Account.Profile.Add(this);
                }
                if (Account_id != Account.Id)
                {
                    Account_id = Account.Id;
                }
            }
        }