public VotingTests() { _ctx = DbContextFactory.Create(Guid.NewGuid().ToString()); _persistance = new VotingSystemPersistance(_ctx); _votingInteractor = new VotingInteractor(_persistance); _pollInteractor = new VotingPollInteractor(new VotingPollFactory(), _persistance); }
public IActionResult OnPost(int counterId, [FromServices] VotingInteractor interactor) { var email = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Email).Value; interactor.Vote(new Vote { UserId = email, CounterId = counterId }); return(Redirect(Request.Path.Value)); }