private TicketItem CreateTicketItem(AnswerTicketCommand request) { return(new TicketItem { TicketId = request.TicketId, Message = request.Message, UserId = _workContext.CurrentUserId }); }
public async Task <Response <TicketItemViewModel> > Handle(AnswerTicketCommand request, CancellationToken cancellationToken) { var ticketItem = CreateTicketItem(request); await UpdateTicketStats(ticketItem); await _ticketItemRepo.AddAsync(ticketItem); return(Response <TicketItemViewModel> .Success(_ticketItemRepo.GetQueryable().Include(x => x.User).ProjectTo <TicketItemViewModel>(_mapper.ConfigurationProvider).Single(x => x.Id == ticketItem.Id))); }