Compare commits

...

2 Commits

2 changed files with 7 additions and 7 deletions

View File

@ -1,5 +1,4 @@
using Marco.Pms.DataAccess.Data;
using Marco.Pms.Model.MongoDBModels;
using Marco.Pms.Model.MongoDBModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MongoDB.Driver;
@ -8,13 +7,10 @@ namespace Marco.Pms.CacheHelper
{
public class EmployeeCache
{
private readonly ApplicationDbContext _context;
//private readonly IMongoDatabase _mongoDB;
private readonly IMongoCollection<EmployeePermissionMongoDB> _collection;
public EmployeeCache(ApplicationDbContext context, IConfiguration configuration)
public EmployeeCache(IConfiguration configuration)
{
var connectionString = configuration["MongoDB:ConnectionString"];
_context = context;
var mongoUrl = new MongoUrl(connectionString);
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name

View File

@ -1184,7 +1184,11 @@ namespace Marco.Pms.Services.Helpers
var emplyeeIds = employeeBucketMappings.Select(eb => eb.EmployeeId).ToList();
List<ContactBucketMapping>? contactBuckets = contactBucketMappings.Where(cb => cb.BucketId == bucket.Id).ToList();
AssignBucketVM bucketVM = bucket.ToAssignBucketVMFromBucket();
bucketVM.EmployeeIds = emplyeeIds;
if (bucketVM.CreatedBy != null)
{
emplyeeIds.Add(bucketVM.CreatedBy.Id);
}
bucketVM.EmployeeIds = emplyeeIds.Distinct().ToList();
bucketVM.NumberOfContacts = contactBuckets.Count;
bucketVMs.Add(bucketVM);
}