parent
2d4d6d3823
commit
eb2edcb3f6
@ -74,7 +74,7 @@ public sealed class BlogService
|
|||||||
/// </param>
|
/// </param>
|
||||||
/// <returns><see langword="true" /> if the author is found; otherwise, <see langword="false" />.</returns>
|
/// <returns><see langword="true" /> if the author is found; otherwise, <see langword="false" />.</returns>
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="post" /> is <see langword="null" />.</exception>
|
/// <exception cref="ArgumentNullException"><paramref name="post" /> is <see langword="null" />.</exception>
|
||||||
public bool TryGetAuthor(int id, [NotNullWhen(true)] out Author? author)
|
public bool TryGetAuthor(Guid id, [NotNullWhen(true)] out Author? author)
|
||||||
{
|
{
|
||||||
using BlogContext context = _dbContextFactory.CreateDbContext();
|
using BlogContext context = _dbContextFactory.CreateDbContext();
|
||||||
author = context.Authors.FirstOrDefault(a => a.Id == id);
|
author = context.Authors.FirstOrDefault(a => a.Id == id);
|
||||||
@ -136,7 +136,7 @@ public sealed class BlogService
|
|||||||
/// otherwise, <see langword="null" />.
|
/// otherwise, <see langword="null" />.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns><see langword="true" /> if the post is found; otherwise, <see langword="false" />.</returns>
|
/// <returns><see langword="true" /> if the post is found; otherwise, <see langword="false" />.</returns>
|
||||||
public bool TryGetBlogPost(int postId, [NotNullWhen(true)] out BlogPost? post)
|
public bool TryGetBlogPost(Guid postId, [NotNullWhen(true)] out BlogPost? post)
|
||||||
{
|
{
|
||||||
using BlogContext context = _dbContextFactory.CreateDbContext();
|
using BlogContext context = _dbContextFactory.CreateDbContext();
|
||||||
post = context.BlogPosts.FirstOrDefault(p => p.Id == postId);
|
post = context.BlogPosts.FirstOrDefault(p => p.Id == postId);
|
||||||
|
Loading…
Reference in New Issue
Block a user