Пример #1
0
        public async Task <IActionResult> Put(int id, ConceptoPagoDto conceptoPagoDto)
        {
            try
            {
                var conceptoPago = _mapper.Map <ConceptoPago>(conceptoPagoDto);
                conceptoPago.IdConcepto = id;
                var result = await _conceptoPagoService.UpdateConceptoPago(conceptoPago);

                var response = new ApiResponse <bool>(result);
                return(Ok(response));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Пример #2
0
        public async Task <IActionResult> Post(ConceptoPagoDto conceptoPagoDto)
        {
            try
            {
                var conceptoPago = _mapper.Map <ConceptoPago>(conceptoPagoDto);
                await _unitOfWork.ConceptoPagoRepository.Add(conceptoPago);

                await _unitOfWork.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }