/// <summary> /// Udaje k polozke stromu /// </summary> /// <param name="request">The request.</param> /// <returns></returns> public object GetList(IListDto request) { HierarchyNode node = Repository.RenderModuleRootNode.FindNode(request.KodPolozky); var pagging = new PaggingParameters { PageNumber = request.Page, PageSize = request.Limit }; var keys = this.Request.QueryString.AllKeys.Except(new string[] { "KodPolozky", "_dc", "page", "start", "limit", "filters", "group", "sort" }).ToList(); if (keys.Count > 0) { Dictionary <string, string> props = this.GetPropertyList(node.ModelType); foreach (string key in keys) { if (props.Keys.Contains(key.ToLower())) { if (request.AdditionalAttributes == null) { request.AdditionalAttributes = new Dictionary <string, string>(); } string p = props[key.ToLower()]; request.AdditionalAttributes.Add(p, this.Request.QueryString[key].Replace("'", "")); } } } object data = this.Repository.GetType().GetMethod("GetList", new Type[] { typeof(BaseListDto), typeof(HierarchyNode), typeof(PaggingParameters) }).MakeGenericMethod(node.ModelType).Invoke(this.Repository, new object[] { request, node, pagging }); if (pagging != null && this.Response != null) { this.Response.AddHeader("Records-Count", pagging.RecordsCount.ToString()); } return(data); }
public static IListDto <TTarget> Map <TTarget, TSource>(this IListDto <TSource> source, Func <TSource, TTarget> mapper) { var listDto = new ListDto <TTarget>(); var items = new List <TTarget>(source.Items.Count); foreach (var item in source.Items) { items.Add(mapper(item)); } listDto.Items = items; listDto.HasNext = source.HasNext; return(listDto); }