示例#1
0
        public bool UpdatePermission(Guid roleId, string resourceIds)
        {
            try
            {
                using (IDbContextBase context = DbContextFactory.GetDbContext())
                {
                    string[]   arrResourceId = resourceIds.Split(',');
                    Permission permission    = null;

                    context.Delete <Permission>(obj => obj.RoleId == roleId, false);

                    for (int i = 0; i < arrResourceId.Length; i++)
                    {
                        permission            = new Permission();
                        permission.Id         = Guid.NewGuid();
                        permission.RoleId     = roleId;
                        permission.ResourceId = arrResourceId[i];

                        context.Insert <Permission>(permission, false);
                    }

                    return(context.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }
示例#2
0
        public bool DeleteCity(Guid cityId)
        {
            try
            {
                using (IDbContextBase context = DbContextFactory.GetDbContext())
                {
                    context.Delete <City>(cityId, false);
                    context.Delete <District>(obj => obj.CityId == cityId, false);

                    return(context.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }
示例#3
0
        public bool DeleteUser(Guid userId)
        {
            try
            {
                using (IDbContextBase context = DbContextFactory.GetDbContext())
                {
                    context.Delete <User>(userId, false);
                    context.Delete <User_Role>(obj => obj.UserId == userId, false);

                    return(context.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }
示例#4
0
        public bool DeleteRole(Guid roleId)
        {
            try
            {
                using (IDbContextBase context = DbContextFactory.GetDbContext())
                {
                    context.Delete <Role>(roleId, false);
                    context.Delete <User_Role>(obj => obj.RoleId == roleId, false);
                    context.Delete <Permission>(obj => obj.RoleId == roleId, false);

                    return(context.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }
示例#5
0
 public bool DeleteUserRole(Guid userRoleId)
 {
     try
     {
         using (IDbContextBase context = DbContextFactory.GetDbContext())
         {
             return(context.Delete <User_Role>(userRoleId));
         }
     }
     catch
     {
         throw;
     }
 }
示例#6
0
        public bool DeleteProperty(Guid propertyId)
        {
            try
            {
                using (IDbContextBase context = DbContextFactory.GetDbContext())
                {
                    context.Delete <Property>(propertyId, false);

                    return(context.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }
示例#7
0
        public bool DeleteDistrict(Guid districtId)
        {
            try
            {
                using (IDbContextBase context = DbContextFactory.GetDbContext())
                {
                    context.Delete <District>(districtId, false);

                    return(context.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }