public ActionResult <Vote> VoteForResolution(string resolutionId, string chosenOption) { int EnumValue = Int32.Parse(chosenOption); if (Enum.GetName(typeof(VoteChosenOption), EnumValue) == Enum.GetName(typeof(VoteChosenOption), 0)) { return(BadRequest()); } else if (!CheckIfAlreadyVotedForResolution(resolutionId)) { string userId = _context.GetUserByEmail(GetUserEmailFromRequest()).Id; Vote newVote = new Vote { UserId = userId, ResolutionId = resolutionId, DateOfVoting = DateTime.Now, ChosenOption = chosenOption }; _context.AddVote(newVote); return(Ok()); } return(BadRequest()); }