File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed
LibraryManagement.Api/Brokers/Storages Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -13,5 +13,6 @@ public partial interface IStorageBroker
1313 IQueryable < Book > SelectAllBooks ( ) ;
1414 ValueTask < Book > SelectBookByIdAsync ( Guid bookId ) ;
1515 ValueTask < Book > UpdateBookAsync ( Book book ) ;
16+ ValueTask < Book > DeleteBookAsync ( Book book ) ;
1617 }
1718}
Original file line number Diff line number Diff line change @@ -33,5 +33,8 @@ public async ValueTask<Book> SelectBookByIdAsync(Guid bookId)
3333
3434 public async ValueTask < Book > UpdateBookAsync ( Book book ) =>
3535 await UpdateAsync ( book ) ;
36+
37+ public async ValueTask < Book > DeleteBookAsync ( Book book ) =>
38+ await DeleteAsync ( book ) ;
3639 }
3740}
Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ public async ValueTask<T> UpdateAsync<T>(T @object)
4343 return @object ;
4444 }
4545
46+ public async ValueTask < T > DeleteAsync < T > ( T @object )
47+ {
48+ var broker = new StorageBroker ( configuration ) ;
49+ broker . Entry ( @object ) . State = EntityState . Deleted ;
50+ await broker . SaveChangesAsync ( ) ;
51+
52+ return @object ;
53+ }
54+
4655 protected override void OnConfiguring ( DbContextOptionsBuilder optionsBuilder )
4756 {
4857 string connectionString =
You can’t perform that action at this time.
0 commit comments