public static MvcHtmlString ChildListLink(this HtmlHelper htmlhelper, IActiveRecordList childList, string linkText = null) { var record = childList.GetParentRecord <ActiveRecord>(); var childTableName = childList.GetTableName(); string foreignKeyName = childList.GetForeignKeyName(); if (linkText == null) { linkText = childList.GetFriendlyTableNamePlural(); } return(ChildListLink(htmlhelper, record, childTableName, linkText, foreignKeyName)); }
/// <summary> /// Returns "first", "last" or "" depending on the loop index within the given active record list. /// To be used as css class names. /// </summary> /// <param name="activeRecordList"></param> /// <returns></returns> public static string FirstLast(IActiveRecordList activeRecordList) { if (activeRecordList.LoopIndex == 0 && activeRecordList.LoopIndex == activeRecordList.Count - 1) { return("first last"); } else if (activeRecordList.LoopIndex == 0) { return("first"); } else if (activeRecordList.LoopIndex == activeRecordList.Count - 1) { return("last"); } return(""); }