//---------------------------------------------------------------------------------------------
// This file was AUTO-GENERATED by "ASP.NET Views" Xomega.Net generator.
//
// Manual CHANGES to this file WILL BE LOST when the code is regenerated.
//---------------------------------------------------------------------------------------------

using AdventureWorks.Client.ViewModels;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Web.UI.WebControls;
using Xomega.Framework.Web;

namespace AdventureWorks.Client.Web
{
    public partial class CustomerListView : WebSearchView
    {
        protected CustomerListViewModel VM => Model as CustomerListViewModel;

        public CustomerListView()
        {
            Model = ServiceProvider.GetService<CustomerListViewModel>();
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (VM == null) return;
        }

        public virtual void PermaLink_Click(object sender, EventArgs e)
        {
            if (VM?.List?.CriteriaObject == null) return;
            Response.Redirect(WebUtil.AddQueryString(Request.RawUrl, VM.List.CriteriaObject.ToNameValueCollection()));
        }
    }
}