public string RenderToProductInformation(int productId) { var discountModel = BuyInTimeService.GetByProduct(productId, DateTime.Now); if (discountModel == null) { return(string.Empty); } var actionTitle = ModuleSettingsProvider.GetSettingValue <string>("BuyInTimeActionTitle", ModuleStringId); var countdown = discountModel.DateExpired != null ? string.Format(BuyInTimeService.CountdownScript, ((DateTime)discountModel.DateExpired).ToString("dd.MM.yyyy HH:mm:ss")) : string.Empty; return(string.Format("<div class=\"buy-in-time-product\"><div class=\"buy-in-time-action-b\">{0}</div> {1}</div>", actionTitle, countdown)); }
public float GetDiscount(int productId) { var model = BuyInTimeService.GetByProduct(productId, DateTime.Now); return(model != null ? model.Discount : 0); }