public static BasketLine ToDomain(this BasketLineForUpdateModel source) { if (source == null) { return(null); } return(new BasketLine { TicketAmount = source.TicketAmount }); }
public async Task <ActionResult <BasketLineModel> > Put(Guid basketId, Guid basketLineId, [FromBody] BasketLineForUpdateModel basketLineForUpdate) { if (!await _mediator.Send(new BasketExistsQuery(basketId))) { return(NotFound()); } var basketLine = await _mediator.Send(new GetBasketLineByIdQuery(basketLineId)); if (basketLine == null) { return(NotFound()); } basketLine.SetTicketAmount(basketLineForUpdate.TicketAmount); await _mediator.Send(new UpdateBasketLineCommand(basketLine)); return(Ok(basketLine.ToModel())); }