Ignore:
Timestamp:
09/18/22 18:09:53 (2 years ago)
Author:
Danilo <danilo.najkov@…>
Branches:
master
Parents:
49b0bbd
Message:

vip functionallity + menu fields + alergens filtering + google/fb login + email queueing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • resTools_backend/backend/Services/ReviewService.cs

    r49b0bbd r13f1472  
    11using backend.Data;
    22using backend.DTOs;
     3using backend.Email;
    34using backend.Entities;
    45using Microsoft.EntityFrameworkCore;
     
    1516    {
    1617        private readonly DataContext _context = null;
     18        private readonly IEmailSender _emailSender;
    1719
    18         public ReviewService(DataContext context)
     20        public ReviewService(DataContext context, IEmailSender emailSender)
    1921        {
    2022            _context = context;
     23            _emailSender = emailSender;
     24
    2125        }
    2226
     
    3943            _context.Restoraunts.Update(res);
    4044            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            }
    4151        }
    4252
Note: See TracChangeset for help on using the changeset viewer.