Exemplo n.º 1
0
        public static BLLRowParticipantDTO FromAPI(RowParticipantMinDTO dto)
        {
            if (dto == null)
            {
                throw new NullReferenceException("Can't map, RowParticipantMinDTO is null");
            }

            return(new BLLRowParticipantDTO()
            {
                Involvement = dto.Involvement,
                AppUserId = dto.UserId,
                ReceiptRowId = dto.RowId.Value
            });
        }
Exemplo n.º 2
0
        public async Task <ActionResult <ReceiptRowAllDTO> > AddParticipantToRow(RowParticipantMinDTO dto)
        {
            if (dto == null)
            {
                return(BadRequest("RowParticipantMinDTO is null"));
            }
            var receiptRow = await _bll.ReceiptsService.AddRowParticipantAsync(RowParticipantMapper.FromAPI(dto), User.GetUserId());

            if (receiptRow == null)
            {
                return(BadRequest("Participant was not added (RowParticipantMinDTO or user might not be valid)"));
            }
            return(ReceiptRowMapper.FromBLL(receiptRow));
        }