Пример #1
0
        public static SettingModel ToModel(this Setting entity, IMDocumentService documentService)
        {
            var img = new MDocument();

            if (!string.IsNullOrWhiteSpace(entity.FileId))
            {
                img = documentService.GetById(entity.FileId);
            }

            var modelVm = new SettingModel()
            {
                Id          = entity.Id,
                CODE        = entity.CODE,
                CreatedBy   = entity.CreatedBy,
                CreatedDate = entity.CreatedDate,
                FileId      = entity.FileId,
                HTMLContent = entity.HTMLContent,
                Published   = entity.Published,
                FileUrl     = img?.FileUrl,
                Show        = entity.Show,
                Type        = entity.Type
            };

            return(modelVm);
        }
Пример #2
0
        public static PricingModel ToViewModel(this Pricing entity, IPricingService pricingService, IMDocumentService documentService)
        {
            var img = new MDocument();

            if (!string.IsNullOrWhiteSpace(entity.ImageId))
            {
                img = documentService.GetById(entity.ImageId);
            }

            var modelVm = new PricingModel()
            {
                Id               = entity.Id,
                CreatedBy        = entity.CreatedBy,
                CreatedDate      = entity.CreatedDate,
                Description      = entity.Description,
                ViewCount        = entity.ViewCount,
                ImageId          = entity.ImageId,
                Name             = entity.Name,
                Published        = entity.Published,
                ShortDescription = entity.ShortDescription,
                ImageUrl         = img?.FileUrl
            };

            return(modelVm);
        }
Пример #3
0
 public CategoryController(IBlogService blogService, ICategoryService categoryService, IMDocumentService documentService)
 {
     _blogService = blogService; _categoryService = categoryService; _documentService = documentService;
 }
Пример #4
0
        public static BlogModel ToViewModel(this Blog entity, IBlogService blogService, ICategoryService categoryService, IMDocumentService documentService)
        {
            var img = new MDocument();

            if (!string.IsNullOrWhiteSpace(entity.ImageId))
            {
                img = documentService.GetById(entity.ImageId);
            }

            var categoryId = blogService.GetCategoryId(entity.Id);
            var category   = categoryService.GetById(categoryId);

            var modelVm = new BlogModel()
            {
                Id               = entity.Id,
                CategoryId       = categoryId,
                CategoryName     = category?.Name,
                CreatedBy        = entity.CreatedBy,
                CreatedDate      = entity.CreatedDate,
                Description      = entity.Description,
                ViewCount        = entity.ViewCount,
                ImageId          = entity.ImageId,
                Name             = entity.Name,
                Published        = entity.Published,
                ShortDescription = entity.ShortDescription,
                ImageUrl         = img?.FileUrl,
                Categories       = categoryService.GetAll().Select(x => new SelectListItem()
                {
                    Selected = categoryId == x.Id, Text = x.Name, Value = x.Id
                }).ToList(),
                Alias        = entity.Alias,
                DisplayOrder = entity.DisplayOrder,
                ShowAtHome   = entity.ShowAtHome
            };

            return(modelVm);
        }
Пример #5
0
 public MediaController(IWebHostEnvironment hostingEnvironment, IMDocumentService documentService)
 {
     _hostingEnvironment = hostingEnvironment;
     _documentService    = documentService;
 }
Пример #6
0
 public PricingController(IPricingService pricingService, IMDocumentService documentService)
 {
     _pricingService = pricingService; _documentService = documentService;
 }