public async Task RemoveVoteOnDescriptionAsync(string userMail, Guid descUuid, Guid metadataUuid) { MetadataTypeDescriptionVote vote = new MetadataTypeDescriptionVote(); vote.UserMail = userMail; vote.MetadataTypeDescriptionUuid = descUuid; _context.MetadataTypeDescriptionVotes.Remove(vote); await _context.SaveChangesAsync(); }
public async Task <IActionResult> VoteOnDescription(Guid metadataTypeUuid, Guid descUuid) { var username = httpContextRetriever.HttpContext.User.Identity.Name; var user = await userService.GetUserByMailAsync(username); if (user.UserType < UserType.Municipality) { return(Unauthorized("User must have municipality privileges or higher")); } MetadataTypeDescriptionVote vote = new MetadataTypeDescriptionVote(); vote.UserMail = user.Mail; vote.MetadataTypeDescriptionUuid = descUuid; await _metadataTypeService.VoteOnDescriptionAsync(vote, metadataTypeUuid); return(Ok()); }
public async Task VoteOnDescriptionAsync(MetadataTypeDescriptionVote vote, Guid metadataUuid) { await _context.MetadataTypeDescriptionVotes.AddAsync(vote); await _context.SaveChangesAsync(); }
public async Task VoteOnDescriptionAsync(MetadataTypeDescriptionVote vote, Guid metadataUuid) { await _metadataTypeRepository.VoteOnDescriptionAsync(vote, metadataUuid); }