public static CustomProductViewModel Convert(CustomProduct product) { CustomProductViewModel model = new CustomProductViewModel(); model.Id = product.Id; model.CategoryId = product.CategoryId; model.Name = product.Name; model.Description = product.Description; model.Subtitle = product.Subtitle; model.ImageSrc = product.ImageSrc; model.Price = product?.Price; model.IsOnSale = product.IsOnSale; model.IsInStock = product.IsInStock; model.Type = product.Type; model.Category = CategoryConverter.Convert(product.Category); if (product.MixCategories != null) { model.MixCategories = MixCategoryConverter.ConvertList(product.MixCategories); } model.Tags = TagConverter.ConvertList(product.Tags); if (product.SelectOptions != null) { model.SelectOptions = CustomSelectOptionConverter.ConvertList(product.SelectOptions); } return(model); }
public static UserSubscriptionMixCategoryViewModel Convert(UserSubscriptionMixCategory mixCategory) { UserSubscriptionMixCategoryViewModel model = new UserSubscriptionMixCategoryViewModel(); model.Id = mixCategory.Id; if (mixCategory.MixCategory != null) { model.MixCategory = MixCategoryConverter.Convert(mixCategory.MixCategory); } if (mixCategory.Ingredients != null) { model.Ingredients = UserSubscriptionMixCategoryIngredientConverter.ConvertList(mixCategory.Ingredients); } return(model); }