Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public JsonResult ManageInvestorContact(int InvestorID, FrontInvestorContactModel contact)
        {
            var result = this.serviceClient.Instance.ManageInvestorContact(this.context.UserId,
                                                                           new Ezbob.Backend.Models.Investor.InvestorContactModel {
                InvestorContactID = contact.InvestorContactID,
                InvestorID        = InvestorID,
                IsGettingAlerts   = contact.IsGettingAlerts,
                IsGettingReports  = contact.IsGettingReports,
                IsActive          = contact.IsActive,
                Comment           = contact.Comment,
                Email             = contact.ContactEmail,
                IsPrimary         = contact.IsPrimary,
                LastName          = contact.ContactLastName,
                PersonalName      = contact.ContactPersonalName,
                Mobile            = contact.ContactMobile,
                OfficePhone       = contact.ContactOfficeNumber,
                Role = contact.Role,
            });

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