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 @@ -12,5 +12,6 @@ public partial interface IStorageBroker
1212 ValueTask < Book > InsertBookAsync ( Book book ) ;
1313 IQueryable < Book > SelectAllBooks ( ) ;
1414 ValueTask < Book > SelectBookByIdAsync ( Guid bookId ) ;
15+ ValueTask < Book > UpdateBookAsync ( Book book ) ;
1516 }
1617}
Original file line number Diff line number Diff line change @@ -30,5 +30,8 @@ public async ValueTask<Book> SelectBookByIdAsync(Guid bookId)
3030
3131 return await ValueTask . FromResult ( readerWithBooks ) ;
3232 }
33+
34+ public async ValueTask < Book > UpdateBookAsync ( Book book ) =>
35+ await UpdateAsync ( book ) ;
3336 }
3437}
Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ public IQueryable<T> SelectAll<T>() where T : class
3434 return broker . Set < T > ( ) ;
3535 }
3636
37+ public async ValueTask < T > UpdateAsync < T > ( T @object )
38+ {
39+ var broker = new StorageBroker ( configuration ) ;
40+ broker . Entry ( @object ) . State = EntityState . Modified ;
41+ await broker . SaveChangesAsync ( ) ;
42+
43+ return @object ;
44+ }
45+
3746 protected override void OnConfiguring ( DbContextOptionsBuilder optionsBuilder )
3847 {
3948 string connectionString =
You can’t perform that action at this time.
0 commit comments