internal static BookEntity ToBookEntity(this BookForCreate bookFroCreate) { return(new BookEntity { Description = bookFroCreate.Description, Title = bookFroCreate.Title }); }
public Task AddBookAsync(BookForCreate bookForCreate) { if (bookForCreate is null) { throw new ArgumentNullException(nameof(bookForCreate)); } return(addBookAsync()); async Task addBookAsync() { var bookEntity = bookForCreate.ToBookEntity(); bookEntity.Id = Guid.NewGuid().ToString(); await _repository.SaveAsync(bookEntity); } }