Exemplo n.º 1
0
        /// <summary>
        /// Prepare news item search model
        /// </summary>
        /// <param name="searchModel">News item search model</param>
        /// <returns>News item search model</returns>
        public virtual NewsItemSearchModel PrepareNewsItemSearchModel(NewsItemSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            _baseAdminModelFactory.PrepareCategories(searchModel.AvailableCategories, true, "Kategori Seçiniz");
            _baseAdminModelFactory.PrepareEditorList(searchModel.AvailableEditor, true, "Editör Seçebilirsiniz");

            //prepare page parameters
            searchModel.SetGridPageSize();

            return(searchModel);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Prepare blog post model
        /// </summary>
        /// <param name="model">Blog post model</param>
        /// <param name="blogPost">Blog post</param>
        /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param>
        /// <returns>Blog post model</returns>
        public virtual BlogPostModel PrepareBlogPostModel(BlogPostModel model, BlogPost blogPost, bool excludeProperties = false)
        {
            //fill in model values from the entity
            if (blogPost != null)
            {
                model           = model ?? blogPost.ToModel <BlogPostModel>();
                model.StartDate = blogPost.StartDateUtc;
                model.EndDate   = blogPost.EndDateUtc;
            }

            //set default values for the new model
            if (blogPost == null)
            {
                model.AllowComments = true;
            }
            _baseAdminModelFactory.PrepareEditorList(model.AvailableEditors, true, "Editor Seçiniz");
            return(model);
        }