Example #1
0
        //Add Bank Account
        public IActionResult AddBankAccount(int accountId = 0)
        {
            if (!_workContext.CurrentCustomer.IsRegistered())
            {
                return(Unauthorized());
            }
            if (!_workContext.CurrentCustomer.IsInCustomerRole(RolesType.Administrators, true) && !_workContext.CurrentCustomer.IsInCustomerRole(RolesType.HaragAdmin, true))
            {
                return(Forbid());
            }

            var model = new PostBankAccount();

            if (accountId != 0)
            {
                var accountModel = _bankService.GetBankAccount(accountId);
                return(View("~/Themes/Pavilion/Views/HaragAdmin/BankAccount/AddBankAccount.cshtml", accountModel));
            }

            return(View("~/Themes/Pavilion/Views/HaragAdmin/BankAccount/AddBankAccount.cshtml", model));
        }
Example #2
0
        public IActionResult AddBankAccountAjax([FromBody] PostBankAccount model)
        {
            if (!_workContext.CurrentCustomer.IsRegistered())
            {
                return(Unauthorized());
            }

            if (!_workContext.CurrentCustomer.IsInCustomerRole(RolesType.Administrators, true) && !_workContext.CurrentCustomer.IsInCustomerRole(RolesType.HaragAdmin, true))
            {
                return(Forbid());
            }

            if (model.Id != 0)
            {
                var response = _bankService.UpdateBankAccount(model);
                return(Json(new { data = response }));
            }

            var result = _bankService.AddBankAccount(model);

            return(Json(new { data = result }));
        }