Esempio n. 1
0
        /// <summary>
        /// Prepare forum group model
        /// </summary>
        /// <param name="model">Forum group model</param>
        /// <param name="forumGroup">Forum group</param>
        /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param>
        /// <returns>
        /// A task that represents the asynchronous operation
        /// The task result contains the forum group model
        /// </returns>
        public virtual Task <ForumGroupModel> PrepareForumGroupModelAsync(ForumGroupModel model, ForumGroup forumGroup, bool excludeProperties = false)
        {
            //fill in model values from the entity
            if (forumGroup != null)
            {
                model ??= forumGroup.ToModel <ForumGroupModel>();
            }

            //set default values for the new model
            if (forumGroup == null)
            {
                model.DisplayOrder = 1;
            }

            return(Task.FromResult(model));
        }
Esempio n. 2
0
        /// <summary>
        /// Prepare forum group model
        /// </summary>
        /// <param name="model">Forum group model</param>
        /// <param name="forumGroup">Forum group</param>
        /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param>
        /// <returns>Forum group model</returns>
        public virtual ForumGroupModel PrepareForumGroupModel(ForumGroupModel model, ForumGroup forumGroup, bool excludeProperties = false)
        {
            //fill in model values from the entity
            if (forumGroup != null)
            {
                model = model ?? forumGroup.ToModel <ForumGroupModel>();
            }

            //set default values for the new model
            if (forumGroup == null)
            {
                model.DisplayOrder = 1;
            }

            return(model);
        }