Exemple #1
0
        public IHttpActionResult Calculate([FromBody] NetPresentValueView netPresentValueView)
        {
            var npv = Mapper.Map <NetPresentValueView, NetPresentValue>(netPresentValueView);
            var netPresentValues = this.netPresentValueService.Calculate(npv);
            var result           = Mapper.Map <IEnumerable <NetPresentValueResult>, IEnumerable <NetPresentValueResultView> >(netPresentValues);

            return(this.Ok(result));
        }
Exemple #2
0
        public async Task <IHttpActionResult> CalculateAndSave([FromBody] NetPresentValueView netPresentValueView)
        {
            try
            {
                var npv = Mapper.Map <NetPresentValueView, NetPresentValue>(netPresentValueView);
                var netPresentValues = this.netPresentValueService.Calculate(npv);
                var result           = Mapper.Map <IEnumerable <NetPresentValueResult>, IEnumerable <NetPresentValueResultView> >(netPresentValues);
                await this.netPresentValueService.InsertNPVAsync(npv);

                return(this.Ok(result));
            }
            catch (Exception ex)
            {
                throw;
            }
        }