public async Task <SaveResponse> SaveSuperUser() { // save role to get ID int RID = await _rRepo.CreateSuperAsync(); // get all prvileges and assign to role var privileges = await _pRepo.getAllAsync(); var rolePrivileges = new List <RolePrivilege>(); if (privileges != null) { foreach (var privilege in privileges) { var rolePriv = new RolePrivilege { PrivilegeID = privilege.ID, RoleID = RID }; rolePrivileges.Add(rolePriv); } // Assign all privileges to the role await _rpRepo.insertListAsync(rolePrivileges); } return(new SaveResponse { ID = RID, Result = "SuperUser Role Created", status = true }); }
public async Task <List <Privilege> > getAllAsync() { var result = await _repo.getAllAsync(); return(result); }