public async Task <ActionResult <ReactionResponse> > Create(CreateReactionRequest model) { model.OwnerId = Account.Id; var reaction = await _reactionService.CreateReaction(model); return(Ok(reaction)); }
public async Task <ReactionResponse> CreateReaction(CreateReactionRequest model) { var reaction = _mapper.Map <Reaction>(model); if (reaction == null) { throw new AppException("Create reaction failed"); } reaction.Created = DateTime.Now; await _context.Reactions.AddAsync(reaction); await _context.SaveChangesAsync(); await SendNotification(reaction.OwnerId, reaction); return(_mapper.Map <ReactionResponse>(reaction)); }