private static string GetCacheKey(string imageUrl, Size targetSize, string alt, string title, object attributes) { var stringBuilder = new StringBuilder(RenderImagePrefix + imageUrl); if (targetSize != default(Size)) { stringBuilder.AppendFormat(";size:{0},{1}", targetSize.Width, targetSize.Height); } if (!string.IsNullOrWhiteSpace(alt)) { stringBuilder.AppendFormat(";alt:{0}", alt); } if (!string.IsNullOrWhiteSpace(title)) { stringBuilder.AppendFormat(";title:{0}", title); } if (!string.IsNullOrWhiteSpace(title)) { stringBuilder.AppendFormat(";title:{0}", title); } if (attributes != null) { var routeValueDictionary = MaterialCMSHtmlHelper.AnonymousObjectToHtmlAttributes(attributes); foreach (var kvp in routeValueDictionary) { stringBuilder.AppendFormat(";{0}:{1}", kvp.Key, kvp.Value); } } return(stringBuilder.ToString()); }
public static MvcForm BeginForm(this HtmlHelper htmlHelper, FormMethod formMethod, object htmlAttributes) { // generates <form action="{current url}" method="post">...</form> string formAction = htmlHelper.ViewContext.HttpContext.Request.RawUrl; return(FormHelper(htmlHelper, formAction, formMethod, MaterialCMSHtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes))); }
public static MvcForm BeginForm <T>(this HtmlHelper htmlHelper, FormMethod formMethod, object htmlAttributes) where T : Webpage, IUniquePage { string formAction = "/" + htmlHelper.ViewContext.HttpContext.Get <IUniquePageService>() .GetUniquePage <T>() .LiveUrlSegment; return(FormHelper(htmlHelper, formAction, formMethod, MaterialCMSHtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes))); }