public override SiocProduct ParseModel(SiocCmsContext _context = null, IDbContextTransaction _transaction = null) { if (string.IsNullOrEmpty(Id)) { Id = Guid.NewGuid().ToString(); CreatedDateTime = DateTime.UtcNow; } if (Properties.Count > 0) { JArray arrProperties = new JArray(); foreach (var p in Properties.Where(p => !string.IsNullOrEmpty(p.Value) && !string.IsNullOrEmpty(p.Name)).OrderBy(p => p.Priority)) { arrProperties.Add(JObject.FromObject(p)); } ExtraProperties = arrProperties.ToString(Formatting.None); } Template = View != null?string.Format(@"{0}/{1}{2}", View.FolderType, View.FileName, View.Extension) : Template; if (ThumbnailFileStream != null) { string folder = SwCmsHelper.GetFullPath(new string[] { SWCmsConstants.Parameters.UploadFolder, "Products", DateTime.UtcNow.ToString("dd-MM-yyyy") }); string filename = SwCmsHelper.GetRandomName(ThumbnailFileStream.Name); bool saveThumbnail = SwCmsHelper.SaveFileBase64(folder, filename, ThumbnailFileStream.Base64); if (saveThumbnail) { SwCmsHelper.RemoveFile(Thumbnail); Thumbnail = SwCmsHelper.GetFullPath(new string[] { folder, filename }); } } if (ImageFileStream != null) { string folder = SwCmsHelper.GetFullPath(new string[] { SWCmsConstants.Parameters.UploadFolder, "Products", DateTime.UtcNow.ToString("dd-MM-yyyy") }); string filename = SwCmsHelper.GetRandomName(ImageFileStream.Name); bool saveImage = SwCmsHelper.SaveFileBase64(folder, filename, ImageFileStream.Base64); if (saveImage) { SwCmsHelper.RemoveFile(Image); Image = SwCmsHelper.GetFullPath(new string[] { folder, filename }); } } Tags = ListTag.ToString(Newtonsoft.Json.Formatting.None); NormalPrice = SwCmsHelper.ReversePrice(StrNormalPrice); DealPrice = SwCmsHelper.ReversePrice(StrDealPrice); ImportPrice = SwCmsHelper.ReversePrice(StrImportPrice); GenerateSEO(); return(base.ParseModel(_context, _transaction)); }