Skip to content

Commit

Permalink
Merge pull request #25 from PasinduPrabhashitha/orders-crud
Browse files Browse the repository at this point in the history
feat✨: return inserted entity after inserting
  • Loading branch information
pasindu-pr authored Apr 8, 2023
2 parents a738cc9 + 3f45660 commit 1b0d93e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/services/Florage.Shared/Contracts/IRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Florage.Shared.Contracts
{
public interface IRepository<T> where T : class
{
Task CreateAsync(T entity);
Task<T> CreateAsync(T entity);
Task DeleteAsync(string id);
Task<IReadOnlyCollection<T>> GetAllAsync();
Task<IReadOnlyCollection<T>> GetAllAsync(Expression<Func<T, bool>> filter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ public GenericRepository(IMongoDatabase database)
dbCollection = database.GetCollection<T>("collection");
}

public async Task CreateAsync(T entity)
public async Task<T> CreateAsync(T entity)
{
await dbCollection.InsertOneAsync(entity);
return entity;
}

public async Task DeleteAsync(string id)
Expand Down

0 comments on commit 1b0d93e

Please sign in to comment.