示例#1
0
        public JsonResult AddInvestor(FrontInvestorModel investor, FrontInvestorContactModel investorContact, List <FrontInvestorBankAccountModel> InvestorBank, bool SameBank)
        {
            if (SameBank)
            {
                var bank = InvestorBank.First();

                var repaymentsBank = new FrontInvestorBankAccountModel {
                    IsActive          = true,
                    AccountType       = (int)I_InvestorAccountTypeEnum.Repayments,
                    BankAccountName   = bank.BankAccountName,
                    BankAccountNumber = bank.BankAccountNumber,
                    BankSortCode      = bank.BankSortCode
                };

                InvestorBank.Add(repaymentsBank);
            }

            var result = this.serviceClient.Instance.CreateInvestor(this.context.UserId,
                                                                    new Ezbob.Backend.Models.Investor.InvestorModel {
                InvestorType = new Ezbob.Backend.Models.Investor.InvestorTypeModel {
                    InvestorTypeID = investor.InvestorType
                },
                Name = investor.CompanyName,
                FundingLimitForNotification = investor.FundingLimitForNotification,
                MonthlyFundingCapital       = investor.MonthlyFundingCapital,
                FundsTransferDate           = investor.FundsTransferDate
            },
                                                                    new[] {
                new Ezbob.Backend.Models.Investor.InvestorContactModel {
                    Comment      = investorContact.Comment,
                    Email        = investorContact.ContactEmail,
                    IsPrimary    = true,
                    LastName     = investorContact.ContactLastName,
                    PersonalName = investorContact.ContactPersonalName,
                    Mobile       = investorContact.ContactMobile,
                    OfficePhone  = investorContact.ContactOfficeNumber,
                    Role         = investorContact.Role,
                }
            },
                                                                    InvestorBank.Select(x => new Ezbob.Backend.Models.Investor.InvestorBankAccountModel {
                BankAccountName   = x.BankAccountName,
                BankAccountNumber = x.BankAccountNumber,
                BankCode          = x.BankSortCode,
                AccountType       = new InvestorAccountTypeModel {
                    InvestorAccountTypeID = x.AccountType
                }
            }).ToArray());

            return(Json(new {
                success = true,
                InvestorID = result.Value,
                investor,
                investorContact,
                InvestorBank,
                SameBank
            }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public JsonResult ManageInvestorBankAccount(int InvestorID, FrontInvestorBankAccountModel bank)
        {
            var result = this.serviceClient.Instance.ManageInvestorBankAccount(this.context.UserId,
                                                                               new Ezbob.Backend.Models.Investor.InvestorBankAccountModel {
                InvestorBankAccountID = bank.InvestorBankAccountID,
                InvestorID            = InvestorID,
                IsActive          = bank.IsActive,
                BankAccountName   = bank.BankAccountName,
                BankAccountNumber = bank.BankAccountNumber,
                BankCode          = bank.BankSortCode,
                AccountType       = new InvestorAccountTypeModel {
                    InvestorAccountTypeID = bank.AccountType
                }
            });

            return(Json(new { InvestorID, bank, success = result.Value }, JsonRequestBehavior.AllowGet));
        }