public async Task<List<Barelvi.Model.Read.Book>> GetAllBooksAsync(Guid userId)
{
var sql = "EXEC Book_ByUserId @UserId";
var parameter = new SqlParameter("@UserId", userId);
var rawBooks = await BarelviContext.Set<Barelvi.DataAccess.Model.Book>()
.FromSqlRaw(sql, parameter)
.ToListAsync();
// Map the raw BookDto results to your domain model (Barelvi.Model.Read.Book)
var books = rawBooks.Select(b => new Barelvi.Model.Read.Book
{
Id = b.Id,
Name = b.Name,
LanguageId = b.LanguageId,
CategoryId = b.CategoryId,
AuthorId = b.AuthorId,
LanguageName = b.LanguageName,
CategoryName = b.CategoryName,
AuthorName = b.AuthorName,
Status = b.Status,
IsDeleted = b.IsDeleted
})
.ToList();
return books;
}
this is my code