Beispiel #1
0
        public Role Add(Role entity)
        {
            if (entity.Id > 0) return entity;

            context.Role.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;
        }
Beispiel #2
0
        private void FixupRole(Role previousValue)
        {
            if (previousValue != null && previousValue.Person.Contains(this))
            {
                previousValue.Person.Remove(this);
            }

            if (Role != null)
            {
                if (!Role.Person.Contains(this))
                {
                    Role.Person.Add(this);
                }
                if (Role_id != Role.Id)
                {
                    Role_id = Role.Id;
                }
            }
        }
Beispiel #3
0
 public void Delete(Role entity)
 {
     context.DeleteObject(entity);
 }
Beispiel #4
0
 public Role Update(Role entity)
 {
     return entity;
 }