Beispiel #1
0
        public virtual ActionResult ContributorNoteAdd(int contributorId, string message)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageContributors))
            {
                return(AccessDeniedView());
            }

            var contributor = _contributorService.GetContributorById(contributorId);

            if (contributor == null)
            {
                return(Json(new { Result = false }, JsonRequestBehavior.AllowGet));
            }

            var contributorNote = new ContributorNote
            {
                Note         = message,
                CreatedOnUtc = DateTime.UtcNow,
            };

            contributor.ContributorNotes.Add(contributorNote);
            _contributorService.UpdateContributor(contributor);

            return(Json(new { Result = true }, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        /// <summary>
        /// Deletes a contributor note
        /// </summary>
        /// <param name="contributorNote">The contributor note</param>
        public virtual void DeleteContributorNote(ContributorNote contributorNote)
        {
            if (contributorNote == null)
            {
                throw new ArgumentNullException("contributorNote");
            }

            _contributorNoteRepository.Delete(contributorNote);

            //event notification
            _eventPublisher.EntityDeleted(contributorNote);
        }
Beispiel #3
0
        /// <summary>
        /// Formats the contributor note text
        /// </summary>
        /// <param name="contributorNote">Contributor note</param>
        /// <returns>Formatted text</returns>
        public static string FormatContributorNoteText(this ContributorNote contributorNote)
        {
            if (contributorNote == null)
            {
                throw new ArgumentNullException("contributorNote");
            }

            string text = contributorNote.Note;

            if (String.IsNullOrEmpty(text))
            {
                return(string.Empty);
            }

            text = HtmlHelper.FormatText(text, false, true, false, false, false, false);

            return(text);
        }