Legend:
- Unmodified
- Added
- Removed
-
resTools_backend/backend/Services/RestaurantService.cs
r49b0bbd r13f1472 45 45 Title = x.Title, 46 46 Description = x.Description, 47 Price = x.Price 47 Price = x.Price, 48 Alergens = x.Alergens, 49 Image = String.Format("data:image/png;base64,{0}", Convert.ToBase64String(x.Image)), 50 IsVipOnly = x.IsVipOnly 48 51 }).ToList(), 49 52 Reviews = x.Reviews.Select(x => new ReviewResponse() … … 55 58 Title = x.Title, 56 59 Username = x.User == null ? "Anonymous" : x.User.Email 57 }).ToList(), 58 AverageReview = x.Reviews.Count>0 ? x.Reviews.Select(x => x.Stars).Average() : 0 60 }).ToList() 59 61 }) 60 62 .FirstOrDefaultAsync(); 63 var reviews = await _context.Reviews.ToListAsync(); 64 res.AverageReview = reviews.Select(x => x.Stars).Sum(); 61 65 return res; 62 66 }
Note:
See TracChangeset
for help on using the changeset viewer.