Changeset 13f1472 for resTools_backend/backend/Services/ReviewService.cs
Legend:
- Unmodified
- Added
- Removed
-
resTools_backend/backend/Services/ReviewService.cs
r49b0bbd r13f1472 1 1 using backend.Data; 2 2 using backend.DTOs; 3 using backend.Email; 3 4 using backend.Entities; 4 5 using Microsoft.EntityFrameworkCore; … … 15 16 { 16 17 private readonly DataContext _context = null; 18 private readonly IEmailSender _emailSender; 17 19 18 public ReviewService(DataContext context )20 public ReviewService(DataContext context, IEmailSender emailSender) 19 21 { 20 22 _context = context; 23 _emailSender = emailSender; 24 21 25 } 22 26 … … 39 43 _context.Restoraunts.Update(res); 40 44 await _context.SaveChangesAsync(); 45 46 if (review.Stars < 3) 47 { 48 var adminUser = await _context.Users.FirstOrDefaultAsync(x => x.IsAdmin); 49 await _emailSender.SendEmailAsync("Добивте лоша оценка", $"<html><h1>{review.Title}</h1><p>{review.Description}</p></html>", adminUser.Email); 50 } 41 51 } 42 52
Note:
See TracChangeset
for help on using the changeset viewer.