public bool AddRolesToGroup(IEnumerable <ApplicationRoleGroup> roleGroups, int groupId) { _appRoleGroupRepository.DeleteMulti(x => x.GroupId == groupId); foreach (var roleGroup in roleGroups) { _appRoleGroupRepository.Add(roleGroup); } return(true); }
public ApplicationGroup Delete(int id) { var appGroup = _appGroupRepository.GetSingleById(id); //xoá các roles thuộc group _appRoleGroupRepository.DeleteMulti(s => s.GroupId == id); //xoá các user thuộc group _appUserGroupRepository.DeleteMulti(s => s.GroupId == id); return(_appGroupRepository.Delete(appGroup)); }