Exemple #1
0
        protected void PreparProductTags(ProductModel model)
        {
            var productTags = _tagService.GetAllTags();

            model.AvailableProductTag = productTags.Items.Select(t => new SelectListItem
            {
                Value = t.Id.ToString(),
                Text  = t.Name
            }).ToList();

            if (model.Id > 0)
            {
                var tags = _tagService.GetAllProductTagMappings(productId: model.Id);
                model.ProductTagIds = tags.Select(m => m.TagId).ToList();
            }
        }