Example #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;
        }
Example #2
0
 public Account Update(Account entity)
 {
     return entity;
 }
Example #3
0
 public void Delete(Account entity)
 {
     context.DeleteObject(entity);
 }
Example #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;
                }
            }
        }