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; } }
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; } }
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; } }
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; } }
public bool DeleteUserRole(Guid userRoleId) { try { using (IDbContextBase context = DbContextFactory.GetDbContext()) { return(context.Delete <User_Role>(userRoleId)); } } catch { throw; } }
public bool DeleteProperty(Guid propertyId) { try { using (IDbContextBase context = DbContextFactory.GetDbContext()) { context.Delete <Property>(propertyId, false); return(context.SaveChanges()); } } catch { throw; } }
public bool DeleteDistrict(Guid districtId) { try { using (IDbContextBase context = DbContextFactory.GetDbContext()) { context.Delete <District>(districtId, false); return(context.SaveChanges()); } } catch { throw; } }