コード例 #1
0
        public bool AddQuizzlingRequestRNotification(DependentRequestFromUser depRequest, bool callSaveChanges = true)
        {
            try
            {
                var primaryParent = _uow.Users.GetAll()
                                    .Where(u => u.Id == depRequest.ToChildId)
                                    .Select(u => u.AsChildDependsOn.Where(d => d.IsPrimary == true).FirstOrDefault().User)
                                    .FirstOrDefault();

                var editor = new RelationshipNotificationEditor(RelationshipNotificationTypeEnum.QuizzlingRequest, depRequest.FromUserId, primaryParent.Id);
                editor.AddDependentRequest(depRequest.Id);

                var entity = editor.GetEntity();
                _uow.RelationshipNotifications.Add(entity);

                if (callSaveChanges)
                {
                    _uow.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }
        }
コード例 #2
0
        public bool AddQuizzmateRequestRNotification(FriendRequest friendRequest, bool callSaveChanges = true)
        {
            try
            {
                var editor = new RelationshipNotificationEditor(RelationshipNotificationTypeEnum.QuizzmateRequest, _currentUser.Id, friendRequest.RequestToId);
                editor.AddFriendRequest(friendRequest.Id);

                var entity = editor.GetEntity();

                _uow.RelationshipNotifications.Add(entity);

                if (callSaveChanges)
                {
                    _uow.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }
        }