Ejemplo n.º 1
0
 /// <summary>
 /// Maps ReceiptRowId, Amount
 /// </summary>
 /// <param name="dto"></param>
 /// <returns></returns>
 /// <exception cref="NullReferenceException"></exception>
 public static BLLReceiptRowDTO FromAPI(ReceiptRowAmountChangeDTO dto)
 {
     if (dto == null)
     {
         throw new NullReferenceException("Can't map, ReceiptRowAmountChangeDTO is null");
     }
     return(new BLLReceiptRowDTO()
     {
         Amount = dto.NewAmount,
         ReceiptRowId = dto.ReceiptRowId
     });
 }
Ejemplo n.º 2
0
        public async Task <ActionResult <ReceiptRowAllDTO> > UpdateRowAmount(ReceiptRowAmountChangeDTO dto)
        {
            if (dto == null)
            {
                return(BadRequest("DTO missing"));
            }
            var receiptRow = await _bll.ReceiptsService.UpdateRowAmount(ReceiptRowMapper.FromAPI(dto), User.GetUserId());

            if (receiptRow == null)
            {
                return(BadRequest());
            }
            return(ReceiptRowMapper.FromBLL(receiptRow));
        }