public JsonResult SetSort(JsonSortRequest sort) { var sortKey = sort.ModuleName;//$"{sort.ModuleName}_sort_keys"; var retSort = CookieHelper.GetValue <List <JsonSortValue> >(sortKey, false) ?? new List <JsonSortValue>(); var existSort = retSort.FirstOrDefault(j => j.SortProperty == sort.SortProperty); if (existSort == null) { retSort.Add(new JsonSortValue { SortProperty = sort.SortProperty, SortDirect = sort.SortDirect }); } else { existSort.SortDirect = sort.SortDirect; } CookieHelper.CreateCookieJsonValue(retSort, sortKey, isSecurity: false); return(Json(new VM_JsonOnlyResult { Result = true, Value = retSort })); }