Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Tuple<long, long> GetDriveSizeAndCountPerOrganization(int organizationId, bool fromTeams, List<UserBackup> userBackups)
- {
- if (userBackups != null && userBackups.Count > 0)
- {
- var sums = userBackups
- .Where(x => x.User.OrganizationId == organizationId && x.ServiceType == (int)ServiceTypeEnum.Drive)
- .GroupBy(x => true)
- .Select(x => new
- {
- TotalSize = fromTeams ? x.Sum(x => x.TotalSizeOnStorageTeams) / 1000 : x.Sum(x => x.TotalSizeOnStorage) / 1000,
- NumberOfItems = fromTeams ? x.Sum(x => x.TotalItemCountTeams) : x.Sum(x => x.TotalItemCount)
- })
- .First();
- if (sums == null) return new Tuple<long, long>(0, 0);
- else return new Tuple<long, long>(sums.TotalSize, sums.NumberOfItems);
- }
- else
- {
- return new Tuple<long, long>(0, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment