public async Task <HistoryDto> AddHistory(AddHistoryDTO model, CancellationToken cancellationToken = default) { if (model is null) { throw new ArgumentNullException("", Resources.ModelIsNull); } var history = _mapper.Map <History>(model); history.Rating = -1; history.CreatedDate = DateTime.UtcNow; await _historyRepository.AddAsync(history, cancellationToken); _emailService.SendEmailAsync(history); return(_mapper.Map <HistoryDto>(history)); }
public async Task <ActionResult <HistoryDto> > AddHistory([FromBody] AddHistoryDTO history) { var result = await _historyService.AddHistory(history); return(Ok(result)); }