Created
July 22, 2019 10:32
-
-
Save ntakouris/0c323cfbce766c7bf169c218500cbe16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<bool> UserOwnsPostAsync(Guid postId, string userId) | |
{ | |
var post = await _dataContext.Posts.AsNoTracking().SingleOrDefaultAsync(x => x.Id == postId); | |
if (post == null) | |
{ | |
return false; | |
} | |
if (post.UserId != userId) | |
{ | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment