Example #1
0
        // protected int CustomerTypeId { get; set; }

        #endregion

        #region Initialisation

        protected override async Task OnInitAsync()
        {
            this.Title         = "Clients";
            this.CustomerTypes = SelectListItems.Convert(await AdministrationService.GetCustomerTypes(), (src, dest) =>
            {
                dest.Id   = src.Id;
                dest.Text = src.Text;
            });
            await LoadCustomers();

            await JavascriptFunctions.InitTable("customerTable");
        }
        protected override async Task OnParametersSetAsync()
        {
            this.CustomerTypes = SelectListItems.Convert(await AdministrationService.GetCustomerTypes(), (src, dest) =>
            {
                dest.Id   = src.Id;
                dest.Text = src.Text;
            });


            if (IsNew())
            {
                this.Title = "Ajouter un client";
            }
            else
            {
                this.Title = "Modifier un client";

                Customer customer = await CustomerService.GetCustomer(Id.Value);

                this.Name           = customer.Name;
                this.FirstName      = customer.FirstName;
                this.CustomerTypeId = customer.CustomerTypeId;
            }
        }