public void UpdateGroup(GroupDto group)
        {
            Group groupEntity= this.ObjectContext.Group.First(x => x.Id == group.Id);
            groupEntity.Name = group.Name;
            groupEntity.Description = group.Description;
            groupEntity.Enabled = group.Enabled;

            //Group GroupChanges = this.ChangeSet.GetOriginal(group);
            //if (GroupChanges != null)
            //{
            //    this.ObjectContext.CreateObjectSet<Group>().AttachAsModified(group, GroupChanges);
            //}
            //else
            //{
            //    this.ObjectContext.Group.Attach(group);
            //}

            this.ObjectContext.SaveChanges();
        }
        //public IQueryable<Model.MapGroupPermission> GetAllMapPermissions()
        //{
        //    return ObjectContext.;
        //}

        public void InsertGroup(GroupDto group)
        {
            Group groupEntity=new Group();
            groupEntity.Name = group.Name;
            groupEntity.Description = group.Description;
            groupEntity.Enabled = group.Enabled;
            this.ObjectContext.AddToGroup(groupEntity);
            //if ((group.EntityState != EntityState.Added))
            //{
            //    if ((group.EntityState != EntityState.Detached))
            //    {
            //        this.ObjectContext.ObjectStateManager.
            //            ChangeObjectState(group, EntityState.Added);
            //    }
            //    else
            //    {
            //        this.ObjectContext.AddToGroup(group);
            //    }
            //}
        }
Exemple #3
0
        /// <summary>
        /// Loads the po.
        /// </summary>
        /// <param name="group">The group.</param>
        public void LoadPo(GroupDto group)
        {
            this.Id = group.Id;
            this.Name = group.Name;
            this.Description = group.Description;
            this.Enabled = group.Enabled;
            foreach (PermissionDto ep in group.Permissions)
            {
                var permission = new PermissionPo();
                permission.Name = ep.Name;
                permission.Id = ep.Id;
                Permissions.Add(permission);

            }
            Permissions.ClearChanges();
        }
Exemple #4
0
 /// <summary>
 /// Transforms to entity.
 /// </summary>
 /// <param name="group">The group.</param>
 /// <returns></returns>
 public GroupDto TransformToEntity(GroupDto group)
 {
     group.Id = Id;
     group.Name = Name;
     group.Description = Description;
     group.Enabled = Enabled;
     return group;
 }
 private bool FilterGroups(GroupDto entity)
 {
     return (entity.UserId == this.Id);
 }