BooksServiceSample.Models.BookChaptersRepository.RemoveAsync C# (CSharp) Méthode

RemoveAsync() public méthode

public RemoveAsync ( System.Guid id ) : Task
id System.Guid
Résultat Task
        public async Task<BookChapter> RemoveAsync(Guid id)
        {
            BookChapter chapter = await _booksContext.Chapters.SingleOrDefaultAsync(c => c.Id == id);
            if (chapter == null) return null;

            _booksContext.Chapters.Remove(chapter);
            await _booksContext.SaveChangesAsync();
            return chapter;
        }