private CalculateNPVApiRequest GetMockRequest() { var calculateNPVApiRequest = new CalculateNPVApiRequest { InitialInvestment = 500000, LowerBoundDiscountRate = 0.1, UpperBoundDiscountRate = 0.1, DiscountRateIncrement = 0.0, CashFlows = new List <double> { 200000.00, 300000.00, 200000.00 } }; return(calculateNPVApiRequest); }
public async Task <IHttpActionResult> CalculateNPV(CalculateNPVApiRequest request) { try { if (!ModelState.IsValid) { return(new BadRequestWithErrorsResult(ModelState)); } var requestId = await CalculationLogic.ManageNPVCalculation(request); return(Ok(requestId)); } catch (Exception ex) { // Put logging here return(new BadRequestWithErrorsResult(ex)); } }