コード例 #1
0
        public async Task <IActionResult> Put(int id, MontoDto montoDto)
        {
            try
            {
                var monto = _mapper.Map <Monto>(montoDto);
                monto.IdReclamante = id;
                var result = await _montoService.UpdateMonto(monto);

                var response = new ApiResponse <bool>(result);
                return(Ok(response));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
コード例 #2
0
        public async Task <IActionResult> Post(MontoDto montoDto)
        {
            try
            {
                var monto = _mapper.Map <Monto>(montoDto);
                await _unitOfWork.MontoRepository.Add(monto);

                await _unitOfWork.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }