예제 #1
0
        public async Task <IActionResult> Approve(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var report = await _reportServices.GetReport(id.Value);

            if (report == null)
            {
                return(NotFound());
            }
            await _reportServices.ApproveReport(id.Value);

            var subscribedEmails = await _userServices.GetSubscribedUsers(report.Industry);

            if (subscribedEmails.Length > 0)
            {
                _emailSenderServices.AutoSendMail(subscribedEmails);
            }
            return(RedirectToAction(nameof(Index)));
        }