public async Task <ActionResult> Put(int id, int billItemId, [FromBody] BillItemFormModel form)
        {
            try
            {
                if (null == form)
                {
                    throw new ArgumentNullException(nameof(form), "The bill item data is null.");
                }

                var updated = await _mediator.Send(new UpdateBillItemRequest(id, billItemId, form));

                if (updated)
                {
                    return(NoContent());
                }
                throw new Exception("The bill item cannot be updated.");
            }
            catch (ArgumentNullException argumentNullException)
            {
                return(BadRequest(argumentNullException.Message));
            }
            catch (NullReferenceException nullReferenceException)
            {
                return(NotFound(nullReferenceException.Message));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
        public async Task <ActionResult <BillItemDto> > Post(int id, [FromBody] BillItemFormModel form)
        {
            try
            {
                if (null == form)
                {
                    throw new ArgumentNullException(nameof(form), "The bill item data is null.");
                }

                var createResult = await _mediator.Send(new CreateBillItemRequest(id, form));

                return(CreatedAtAction(nameof(this.Get), new { id, billItemId = createResult.Id }, createResult));
            }
            catch (ArgumentNullException argumentNullException)
            {
                return(BadRequest(argumentNullException.Message));
            }
            catch (NullReferenceException nullReferenceException)
            {
                return(NotFound(nullReferenceException.Message));
            }
        }
 public UpdateBillItemRequest(int billId, int billItemId, BillItemFormModel billItemFormModel)
 {
     BillId            = billId;
     BillItemId        = billItemId;
     BillItemFormModel = billItemFormModel;
 }