public IList<CommentsDetailsDto> GetComments()
{
return db.Comments.Select(p => new CommentsDetailsDto
{
Rating = p.Rating,
Description = p.Description,
GuestId = p.GuestId, /*foreign key*/
HotelId = p.HotelId, /* foreign key */
}).ToList();
}
comments table contains hotelid and guestid as foreign key. the api returns hotel id and guest id but i want to get fields like hotel name and guest name from the table. how do i go about it
Aucun commentaire:
Enregistrer un commentaire