private TableRowViewModel CreateItem(Product product, CurrencyString price) { var cells = user != null ? new List <TableCellViewModel> { new TableCellViewModel(new ImageThumbnailViewModel { ThumbnailId = product.MainImageId ?? Guid.Empty, Width = 64 }), new TableCellViewModel(product.Name), new TableCellViewModel(this.GetProductAvailableString(product)), new TableCellViewModel(price != null ? price.ToString() : StringResource.NotAvailable), //user.IsAdmin ? new TableCellViewModel(string.Empty) : new TableCellViewModel(this.CreateAddToCartLink(product)) new TableCellViewModel(string.Empty) } : new List <TableCellViewModel> { new TableCellViewModel(new ImageThumbnailViewModel { ThumbnailId = product.MainImageId ?? Guid.Empty, Width = 64 }), new TableCellViewModel(product.Name) }; var actionLink = this.CreateProductActionLink(product); return(new TableRowViewModel { Cells = cells, Id = product.VersionId.ToString(), ParentId = actionLink != null && actionLink.ParentId != null?actionLink.ParentId.ToString() : null }); }
private TileViewModel CreateItem(Product product, CurrencyString price) { var tileViewModel = new TileViewModel { Link = this.CreateProductActionLink(product), ImageId = product.MainImageId ?? Guid.Empty, Name = product.Name }; if (this.user != null) { var attributes = new AttributeList(); attributes.Add(new KeyValuePair <string, string>(StringResource.productTile_Available, this.GetProductAvailableString(product))); if (price != null) { attributes.Add(new KeyValuePair <string, string>(StringResource.productTile_Price, price.ToString())); } tileViewModel.Attributes = attributes; /* * if (!user.IsAdmin) * { * tileViewModel.Action = this.CreateAddToCartLink(product); * } */ } return(tileViewModel); }