public async Task <CreateVotingResponseDto> CreateVoting(CreateVotingRequestDto voting) { Voting newVoting = new Voting { ID = new Guid(), Name = voting.Name, CreatedDate = DateTime.Now, Description = voting.Description, DueDate = voting.DueDate, CategoryId = voting.CategoryId }; var addedVoting = await _votingRepository.AddAsync(newVoting); CreateVotingResponseDto response = new CreateVotingResponseDto { Name = addedVoting.Name, Description = addedVoting.Description, CreatedDate = addedVoting.CreatedDate, DueDate = addedVoting.DueDate, VotersCount = addedVoting.VotersCount }; return(response); }
public async Task <ActionResult <CreateVotingResponseDto> > Create(CreateVotingRequestDto request) { var voting = await _service.CreateVoting(request); return(Ok(voting)); }