Exemple #1
0
        public Task PrepareStoreAsync(User user, StoreEditModel model)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            user = _mapper.Map(model, user);

            user.StoreCategory = model.StoreCategorySelections.MergeEnums();

            user.StoreSlug = SanitizerHelper.GenerateSlug(model.StoreSlug);

            user.AboutNote   = SanitizerHelper.SanitizeHtml(model.AboutNote);
            user.TermsNote   = SanitizerHelper.SanitizeHtml(model.TermsNote);
            user.PrivacyNote = SanitizerHelper.SanitizeHtml(model.PrivacyNote);
            user.ReturnsNote = SanitizerHelper.SanitizeHtml(model.ReturnsNote);
            user.ReviewsNote = SanitizerHelper.SanitizeHtml(model.ReviewsNote);


            user.FacebookLink   = SanitizerHelper.AppendUrlScheme(model.FacebookLink);
            user.TwitterLink    = SanitizerHelper.AppendUrlScheme(model.TwitterLink);
            user.YoutubeLink    = SanitizerHelper.AppendUrlScheme(model.YoutubeLink);
            user.InstagramLink  = SanitizerHelper.AppendUrlScheme(model.InstagramLink);
            user.LinkedInLink   = SanitizerHelper.AppendUrlScheme(model.LinkedInLink);
            user.PinterestLink  = SanitizerHelper.AppendUrlScheme(model.PinterestLink);
            user.WhatsAppNumber = SanitizerHelper.ExtractPhoneNumber(model.WhatsAppNumber);
            user.MapLink        = SanitizerHelper.AppendUrlScheme(model.MapLink);

            return(Task.CompletedTask);
        }
Exemple #2
0
        public Task PrepareProductAsync(Product product, ProductEditModel model)
        {
            if (product == null)
            {
                throw new ArgumentNullException(nameof(product));
            }
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            product             = _mapper.Map(model, product);
            product.Description = SanitizerHelper.SanitizeHtml(model.Description);

            return(Task.CompletedTask);
        }