public void Vote(OptionVoteVM optionVote) { var option = _optionRepository.GetById(optionVote.Option_id); option.Vote(); _optionRepository.Update(option); }
public ActionResult <IEnumerable <string> > Post(int id, [FromBody] OptionVoteVM option) { try { var poll = _mapper.Map <PollVM>(_pollService.GetById(id)); if (poll == null) { return(NotFound()); } option.Id = id; _optionService.Vote(option); return(Ok()); } catch (Exception e) { return(BadRequest(e.Message)); throw; } }