/// <summary>
 /// ขอรายการ comment จากรหัสผู้ใช้ที่เกี่ยวข้อง
 /// </summary>
 /// <param name="userprofileId"></param>
 /// <returns></returns>
 public async Task<IEnumerable<Comment>> GetCommentByRelatedUserProfileId(string userprofileId)
 {
     var mongoUtil = new MongoAccess.MongoUtil(PrimaryConnectionString, PrimaryDatabaseName);
     var qry = (await mongoUtil.GetCollection<Comment>(TableName)
         .FindAsync(it => !it.DeletedDate.HasValue && (it.CreatedByUserProfileId == userprofileId || it.Discussions.Any(d => !d.DeletedDate.HasValue && d.CreatedByUserProfileId == userprofileId))))
         .ToEnumerable();
     return qry;
 }
        /// <summary>
        /// ขอรายการ comment จากรหัสผู้ใช้ที่เกี่ยวข้อง
        /// </summary>
        /// <param name="userprofileId"></param>
        /// <returns></returns>
        public async Task <IEnumerable <Comment> > GetCommentByRelatedUserProfileId(string userprofileId)
        {
            var mongoUtil = new MongoAccess.MongoUtil(PrimaryConnectionString, PrimaryDatabaseName);
            var qry       = (await mongoUtil.GetCollection <Comment>(TableName)
                             .FindAsync(it => !it.DeletedDate.HasValue && (it.CreatedByUserProfileId == userprofileId || it.Discussions.Any(d => !d.DeletedDate.HasValue && d.CreatedByUserProfileId == userprofileId))))
                            .ToEnumerable();

            return(qry);
        }
 /// <summary>
 /// อัพเดท comment
 /// </summary>
 /// <param name="data">Comment ที่จะทำการอัพเดท</param>
 public async Task UpdateComment(Comment data)
 {
     var mongoUtil = new MongoAccess.MongoUtil(PrimaryConnectionString, PrimaryDatabaseName);
     var filter = Builders<Comment>.Filter.Eq(it => it.id, data.id);
     var update = Builders<Comment>.Update
         .Set(it => it.CreatorDisplayName, data.CreatorDisplayName)
         .Set(it => it.CreatorImageUrl, data.CreatorImageUrl)
         .Set(it => it.Discussions, data.Discussions);
     await mongoUtil.GetCollection<Comment>(TableName).UpdateOneAsync(filter, update);
 }
        /// <summary>
        /// อัพเดท comment
        /// </summary>
        /// <param name="data">Comment ที่จะทำการอัพเดท</param>
        public async Task UpdateComment(Comment data)
        {
            var mongoUtil = new MongoAccess.MongoUtil(PrimaryConnectionString, PrimaryDatabaseName);
            var filter    = Builders <Comment> .Filter.Eq(it => it.id, data.id);

            var update = Builders <Comment> .Update
                         .Set(it => it.CreatorDisplayName, data.CreatorDisplayName)
                         .Set(it => it.CreatorImageUrl, data.CreatorImageUrl)
                         .Set(it => it.Discussions, data.Discussions);

            await mongoUtil.GetCollection <Comment>(TableName).UpdateOneAsync(filter, update);
        }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public NotificationRepository(MongoAccess.MongoUtil mongoUtil, IOptions<DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName = option.Value.Notifications;
 }
Exemple #6
0
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public CourseCatalogRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.CourseCatalogs;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public UserProfileRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.UserProfiles;
 }
Exemple #8
0
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public StudentKeyRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.StudentKeys;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public CommentRepository(MongoAccess.MongoUtil mongoUtil, IOptions<DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName = option.Value.Comments;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public FriendRequestRepository(MongoAccess.MongoUtil mongoUtil, IOptions<DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName = option.Value.FriendRequests;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public LikeDiscussionRepository(MongoAccess.MongoUtil mongoUtil, IOptions<DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName = option.Value.LikeDiscussions;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public StudentKeyRepository(MongoAccess.MongoUtil mongoUtil, IOptions<DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName = option.Value.StudentKeys;
 }
Exemple #13
0
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public LikeDiscussionRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.LikeDiscussions;
 }
Exemple #14
0
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public FriendRequestRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.FriendRequests;
 }
Exemple #15
0
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public ClassCalendarRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.ClassCalendars;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public LessonCatalogRepository(MongoAccess.MongoUtil mongoUtil, IOptions<DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName = option.Value.LessonCatalogs;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public PaymentRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.Payments;
 }
Exemple #18
0
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public ContractRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.Contracts;
 }
Exemple #19
0
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public LessonTestResultRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.LessonTestResults;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public ClassRoomRepository(MongoAccess.MongoUtil mongoUtil, IOptions<DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName = option.Value.ClassRooms;
 }
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public UserProfileRepository(MongoAccess.MongoUtil mongoUtil, IOptions<DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName = option.Value.UserProfiles;
 }
Exemple #22
0
 /// <summary>
 /// Initialize repository
 /// </summary>
 /// <param name="mongoUtil">Mongo access utility</param>
 public NotificationRepository(MongoAccess.MongoUtil mongoUtil, IOptions <DatabaseTableOptions> option)
 {
     _mongoUtil = mongoUtil;
     TableName  = option.Value.Notifications;
 }