Пример #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);
            }
        }
        public bool AddQuizzlingRequestAcceptNotification(DependentRequestFromUser depRequest, bool callSaveChanges = true)
        {
            try
            {
                var editor = new NewNotificationEditor(NotificationTypeEnum.QuizzlingAccept, depRequest.ToChildId, depRequest.FromUserId);

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

                if (callSaveChanges)
                {
                    _uow.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }
        }