Exemplo n.º 1
0
        public ActionResult InvestorProductDetails(InvestorProductDetailsViewModel model)
        {
            bool isUpdated = false;

            try
            {
                if (ModelState.IsValid)
                {
                    if (model.InvestorProduct.DefaultPricing != PricingType.None &&
                        model.InvestorProduct.CDTIPricingTypes != null &&
                        model.InvestorProduct.CDTIPricingTypes.Contains(model.InvestorProduct.DefaultPricing) &&
                        model.InvestorProduct.AusTypes != null && model.InvestorProduct.AusTypes.Count > 0)
                    {
                        model.InvestorProduct.InvestorWebsiteURL = model.InvestorWebsiteUrl;
                        isUpdated = _productServiceFacade.InvestorProductInsertOrUpdate(new InvestorProductInsertOrUpdate
                        {
                            InvestorProduct = model.InvestorProduct,
                            UserAccountId   = _userAccountId
                        });
                    }
                    return(Json(new { success = true, isUpdated }));
                }
            }
            catch (Exception exception)
            {
                TraceHelper.Error(TraceCategory.LoanCenter, "InvestorConfigurationController::InvestorProductDetails[POST]", exception, Guid.Empty, _userAccountId);
                return(Json(new { success = false }));
            }
            return(Json(new
            {
                success = false,
                errors = ModelState.Keys.SelectMany(k => ModelState[k].Errors)
                         .Select(m => m.ErrorMessage).ToArray()
            }));
        }
Exemplo n.º 2
0
        public ActionResult InvestorProductDetails(int investorId, int investorProductId = -1)
        {
            try
            {
                var investorRulesConfiguration     = _productServiceFacade.RetrieveInvestorRulesConfiguration();
                var retrieveInvestorProductDetails = new RetrieveInvestorProductDetails {
                    InvestorProductId = investorProductId
                };


                var investorProduct = investorProductId == -1 ?
                                      new InvestorProduct
                {
                    InvestorProductId   = -1,
                    InvestorId          = investorId,
                    AusTypes            = new List <AusType>(),
                    CDTIPricingTypes    = new List <PricingType>(),
                    InvestorProductRule = new InvestorProductRule()
                } :
                _productServiceFacade.RetrieveInvestorProductDetails(retrieveInvestorProductDetails);


                if (investorRulesConfiguration == null || investorProduct == null || (investorProduct.InvestorProductId != -1 && investorProduct.InvestorProductRule == null))
                {
                    return(ShowErrorMessage());
                }

                var investorProductDetailsViewModel = new InvestorProductDetailsViewModel
                {
                    InvestorProduct = investorProduct,
                    InvestorRules   = investorRulesConfiguration.Select(r => new SelectListItem
                    {
                        Value    = r.InvestorRulesConfigurationId.ToString(),
                        Text     = r.Description,
                        Selected = investorProduct.InvestorProductRule != null && r.InvestorRulesConfigurationId == investorProduct.InvestorProductRule.InvestorRulesConfigurationId
                    }).ToList(),
                    InvestorWebsiteUrl = investorProduct.InvestorWebsiteURL
                };

                return(PartialView("SystemAdmin/InvestorConfiguration/_investorproductdetails", investorProductDetailsViewModel));
            }
            catch (Exception exception)
            {
                TraceHelper.Error(TraceCategory.LoanCenter, "InvestorConfigurationController::InvestorProductDetails[GET]", exception, Guid.Empty, _userAccountId);
                return(ShowErrorMessage());
            }
        }