public async Task <BookShopState> GetOrCreateBookShopState(int id) { BookShopState bookShopState = await Set <BookShopState>() .FirstOrDefaultAsync(bss => bss.Id == id); if (bookShopState == null) { bookShopState = new BookShopState(); await Set <BookShopState>() .AddAsync(bookShopState); await SaveChangesAsync(); } return(bookShopState); }
public async Task UpdateBookShopState(BookShopState bookShopState) { Set <BookShopState>().Update(bookShopState); await SaveChangesAsync(); }