public IActionResult Add(OpinionPostDto opinionPostDto) { _opinionService.AddOpinion(opinionPostDto); int w = 7; return(Ok()); }
public void AddOpinion(OpinionPostDto opinionPostDto) { Context context = new Context(); OpinionEntity opinionEntity = _mapper.Map(opinionPostDto, new OpinionEntity()); if (opinionEntity != null) { UserEntity userEntity = _userRepository.GetUserByUserId(opinionPostDto.GuidUserId, context); userEntity.OpinionEntity.Add(opinionEntity); context.SaveChanges(); } }