Example #1
0
        public ChurchReview Create()
        {
            if (IsPersisted())
            {
                throw new ModelAlreadyPersistedException("This model is already saved in the database.");
            }

            var churchReview = _churchReviewService.Create(this);

//            var notification = new Notification
//            {
//                UserId = (churchReview.UserId == 0) ? churchReview.UserId : 0,
//                Title = "New review was published",
//                Description =
//                    churchReview.User.FullName + " published a new review for " + churchReview.Simbahan.Parish,
//                User = (churchReview.UserId == 0) ? new User() : churchReview.User,
//                Action = NotificationAction.OnChurchReviewPublished + churchReview.SimbahanId
//            };
//
//            OnChurchReviewPublished(new NotificationEventArgs(notification, churchReview.SimbahanId));

            return(churchReview);
        }
Example #2
0
        public ChurchReview Create()
        {
            if (IsPersisted())
            {
                throw new ModelAlreadyPersistedException("This model is already saved in the database.");
            }

            var churchReview = _churchReviewService.Create(this);

            var notification = new Notification
            {
                UserId      = churchReview.UserId,
                Title       = "New review was published",
                Description =
                    churchReview.User.FullName + " published a new review for " + churchReview.Simbahan.Parish,
                User   = churchReview.User,
                Action = NotificationAction.OnChurchReviewPublished + churchReview.SimbahanId
            };

            OnChurchReviewPublished(new NotificationEventArgs(notification, churchReview.SimbahanId));

            return(churchReview);
        }