Ejemplo n.º 1
0
        public HttpResponseMessage UpdateProviderGroupAccountStatus(ProviderPortfolio portfolio)
        {
            var modelValidation = portfolio.Validate(this.AccountSession, ValidationMode.State);

            if (modelValidation.IsValid)
            {
                try
                {
                    // update the account status
                    var results = this.Uow.ProviderPortfolios.UpdateAccountStatus(portfolio);

                    // let the agent handle any additional processing
                    this.Agent.ProviderPortfolioAccountStatusChanged(results);

                    // request successful
                    return(CreateSuccessResponse(new { success = true, results = results }, HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    Logger.Error(string.Format("Exception detected attempting to retrieve pending providers via user Id {0}", this.AccountSession.MemberId), ex);

                    return(CreateErrorResponse(ex));
                }
            }

            // invalid parameters, generate response
            return(CreateInvalidResponse(modelValidation));
        }
Ejemplo n.º 2
0
        public HttpResponseMessage CreateProviderPortfolio(ProviderPortfolio portfolio)
        {
            var modelValidation = portfolio.Validate(this.AccountSession, ValidationMode.Create);

            if (modelValidation.IsValid)
            {
                try
                {
                    // create the provider portfolio for this principal
                    var portfolioTemp = this.Uow.ProviderPortfolios.CreatePortfolio(portfolio);

                    // get the updated provider member (with new provider portfolio)
                    var results = this.Uow.ProviderMembers.GetScheme(this.AccountSession.MemberId);

                    return(CreateSuccessResponse(new { success = true, results = results }, HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    // log exception
                    Logger.Error(string.Format("Exception detected attempting to create provider portfolio via user {0}", this.AccountSession.MemberId), ex);

                    return(CreateErrorResponse(ex));
                }
            }

            // invalid parameters, generate response
            return(CreateInvalidResponse(modelValidation));
        }