Esempio n. 1
0
        public IHttpActionResult CreateNewReturnCapital(ReturnOfCapitalActionCreationModel model)
        {
            var userid = User.Identity.GetUserId();

            //Console.WriteLine("create new return of captial Check");
            if (model != null && ModelState.IsValid)
            {
                ReturnOfCapitalCreationModel repoModel = new ReturnOfCapitalCreationModel();
                repoModel.AccountsInfo   = new List <ReturnOfCapitalParticipantAccounts>();
                repoModel.AdjustmentDate = model.returnDate;
                repoModel.AdviserId      = userid;
                repoModel.ActionName     = model.actionName;
                repoModel.Ticker         = model.equityId;
                var partiInfo = model.ParticipantsInfo;
                foreach (var acc in partiInfo)
                {
                    var newAccount = new ReturnOfCapitalParticipantAccounts()
                    {
                        AccountNumber = acc.accountNumber,
                        ReturnAmount  = acc.returnAmount
                    };
                    repoModel.AccountsInfo.Add(newAccount);
                }
                repo.CreateNewReturnOfCapitalAction(repoModel);


                return(Ok());
            }
            return(BadRequest());
        }