//public static void FormatDates(this NotificationVMList vm, bool pastTime = true) //{ // for (int i = 0; i < vm.List.Count; i++) // if (pastTime) // vm.List[i].CreateTime = vm.List[i].CreateTime.ToPastTimeLocalizedString(); // else vm.List[i].CreateTime = vm.List[i].CreateTime.ToLocalizedString(); //} public static void FormatTitle(this NotificationVMList vm) { //var localizer = new Resources.Localizer<Resources.Messages>(); //for (int i = 0; i < vm.List.Count; i++) //{ // vm.List[i].Description = localizer[vm.List[i].Type + "Description"]; // vm.List[i].Title = localizer[vm.List[i].Type+"Title"]; //} throw new System.NotImplementedException(); }
public static void FormatUrls(this NotificationVMList vm) { var helper = new System.Web.Mvc.UrlHelper(System.Web.HttpContext.Current.Request.RequestContext); for (int i = 0; i < vm.List.Count; i++) { if (string.IsNullOrEmpty(vm.List[i].JsonUrl)) { continue; } var url = Newtonsoft.Json.JsonConvert.DeserializeObject <Url>(vm.List[i].JsonUrl); vm.List[i].Url = helper.AbsoluteAction(url); } }