Exemple #1
0
        public async Task UpdateAsync([FromBody] PnLStopLossEngineModel pnLStopLossEngineModel)
        {
            try
            {
                var pnLStopLossEngine = Mapper.Map <PnLStopLossEngine>(pnLStopLossEngineModel);

                await _pnLStopLossEngineService.UpdateAsync(pnLStopLossEngine);
            }
            catch (EntityNotFoundException)
            {
                throw new ValidationApiException(HttpStatusCode.NotFound, "Stop loss engine does not exist.");
            }
        }
Exemple #2
0
        public async Task AddAsync([FromBody] PnLStopLossEngineModel pnLStopLossEngineModel)
        {
            try
            {
                var pnLStopLossEngine = Mapper.Map <PnLStopLossEngine>(pnLStopLossEngineModel);

                await _pnLStopLossEngineService.AddAsync(pnLStopLossEngine);
            }
            catch (InvalidOperationException exception)
            {
                throw new ValidationApiException(HttpStatusCode.BadRequest, exception.Message);
            }
        }