Exemplo n.º 1
0
        /// <summary>
        /// Updates an element's details.
        /// </summary>
        /// <param name="settings">Updated element settings.</param>
        /// <param name="unitOfWork">Unit of work.</param>
        public void Update(IElementSettings settings, IUnitOfWork unitOfWork = null)
        {
            // Ensure sort orders are correct
            TestimonialSettings testimonialSettings = (TestimonialSettings)settings;

            for (int index = 0; index < testimonialSettings.Comments.Count; index++)
            {
                TestimonialComment testimonialComment = testimonialSettings.Comments[index];
                testimonialComment.SortOrder   = index;
                testimonialComment.AuthorTitle = string.IsNullOrWhiteSpace(testimonialComment.AuthorTitle) ? string.Empty : testimonialComment.AuthorTitle.Trim();
                testimonialComment.CommentDate = string.IsNullOrWhiteSpace(testimonialComment.CommentDate) ? string.Empty : testimonialComment.CommentDate.Trim();
            }

            // Do the update
            _testimonialRepository.Update((TestimonialSettings)settings, unitOfWork);
        }