//public Dictionary<string, List<string>> Filter { get; set; } public virtual IActionResult ToActionResult(ControllerEditable <K, T, R> controller) { var Logger = controller.LoggerFactory.CreateLogger(this.GetType().FullName); var vm = new ListVM <K, T, R>(controller, this); try { if (!typeof(T).IsImplementsInterface(typeof(IWithSiteId))) { // а юзеры тут могут быть? vm.Items = controller.Sites.GetForUser(controller.SessionUser.Id).Select(i => (IBaseDM)i).ToList(); } else { using (new BLog(controller.LoggerMEF, "ListIM::ToActionResult", GetType().FullName)) vm.Items = controller.Repository.GetFiltered(controller.Site.Id, vm.Form).Take(30).Select(i => (IBaseDM)i).ToList(); } } catch (Exception e) { vm.Error = e; } var tmp = vm.Form; return(controller.View("Admin/List", vm)); }
public virtual IActionResult ToActionResult(ControllerEditable <K, T, R> controller) { var Logger = controller.LoggerFactory.CreateLogger(this.GetType().FullName); //var LoggerMEF = controller.LoggerFactory.CreateLogger(Utils.MEFNameSpace); var vm = new EditVM <K, T, R>(controller) { Input = this }; return(controller.View("Admin/Edit", vm)); }
public ListVM(ControllerEditable <K, T, R> controller, ListIM <K, T, R> input) : base(controller) { Input = input; string href; var title = controller.Localizer2Garin.Localize("common.breadcrumb.main"); if (title != "") { href = controller.Url.RouteUrlWithCulture("Page", new { page = "index.html" }); Breadcrumb.Items.Add(new MenuItem(href, new HtmlString(title))); } href = controller.Url.RouteUrlWithCulture("Admin", new { controller = "sites" }); Breadcrumb.Items.Add(new MenuItem(href, controller.Localizer2Garin.LocalizeHtml("common.breadcrumb.admin"))); Breadcrumb.Items.Add(new MenuItem(null, GetH1())); }
public EditVM(ControllerEditable <K, T, R> controller) : base(controller) { }